La requête PHPcurl multipart/form-data a échoué
P粉331849987
P粉331849987 2024-02-03 23:03:26
0
1
442

J'essaie d'obtenir une réponse de l'éditeur Oracle Bi en utilisant php-curl et en utilisant l'en-tête comme multipart/form-data mais le résultat est échec de la demande

J'ai également essayé d'obtenir le code directement auprès du facteur car cela fonctionnait bien mais provoquait également l'échec des demandes

Veuillez aider à corriger le code

<?php
 
$ch = curl_init();
 
curl_setopt($ch, CURLOPT_URL, 'HOST:PORT/xmlpserver/services/rest/v1/reports/OBTF%2Frapport%2FECHANCE%20LC%2Fapi2/run');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('ReportRequest' => '{\"attributeFormat\":\"html\",\"attributeTemplate\":\"Publisher Template\"}'));
curl_setopt($ch, CURLOPT_USERPWD, 'login' . ':' . 'password');
 
$headers = array();
$headers[] = 'Content-Type: multipart/form-data';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
 
$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
echo $result;
curl_close($ch);

P粉331849987
P粉331849987

répondre à tous(1)
P粉903969231

@CBroe

CURLOPT_URL => 'http://HOST:PORT/xmlpserver/services/rest/v1/reports/OBTF%2Frapport%2FECHANCE%20LC%2Fapi2/run',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_SSL_VERIFYPEER=> false,
  CURLOPT_HEADER=> FALSE,
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array("ReportRequest"=>'{"attributeFormat":"html","attributeTemplate":"Publisher Template"}'),
  CURLOPT_HTTPHEADER => array(
 'Content-Type: multipart/form-data;boundary=--Boundary_4_543972006_1465550732054--','Content-Length:1'
  ),
));```
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!