Proper way to send (POST) xml with guzzle 6

后端 未结 2 1401
南旧
南旧 2021-02-12 16:58

I want to perform a post with guzzle sending an xml file. I did not find an example.

What I \'ve done so far is :

$xml2=simplexml_load_string($xml) or d         


        
2条回答
  •  南旧
    南旧 (楼主)
    2021-02-12 17:59

    After some experiments, I have figured it out. Here is my solution in case someone reaches a dead end.

    $request = new Request(
        'POST', 
        $uri,
        ['Content-Type' => 'text/xml; charset=UTF8'],
        $xml
    );
    

提交回复
热议问题