简体   繁体   中英

viewing guzzle post request

i would like to see the post request packet before i send it as there is an error in the req and a the api is a general descript 500 error so i cant tell where y request is failing. i mnow the xml is formatted wrong as it works on postman from chrome.

$client = new GuzzleHttp\Client([
            'base_uri' => 'https://elstestserver.endicia.com',
        ]);
$xml = 'changePassPhraseRequestXML=<ChangePassPhraseRequest>  <RequesterID>lxxx</RequesterID><RequestID>1263055835</RequestID><CertifiedIntermediary><AccountID>lxxx</AccountID><PassPhrase>dfdsfsd</PassPhrase></CertifiedIntermediary><NewPassPhrase>fdfdsfdsfs</NewPassPhrase></ChangePassPhraseRequest>';

    $data = array("ChangePassPhraseXML" => $xml);

  $response = $client->post("/LabelService/EwsLabelService.asmx/ChangePassPhraseXML", [
'form_params'    => $data
]);

this request works in postman for chrome the heres a working example of the xml

changePassPhraseRequestXML=<ChangePassPhraseRequest><RequesterID>lxxx</RequesterID><RequestID>1263055835</RequestID><CertifiedIntermediary><AccountID>lxxx</AccountID><PassPhrase>dfdsfsd</PassPhrase></CertifiedIntermediary><NewPassPhrase>fdsfdsfds</NewPassPhrase></ChangePassPhraseRequest>

Use Logger middleware

About middlewares for guzzle

Also, 500 error is server fail, not yours.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM