Get XML Response using CURL, FOPEN or FILE_GET_CONTENTS in PHP -


i create php script perform request https site using method. in return, response in xml format. need able contents/save xml.

i've tried using curl, file_get_contents, fopen i'm getting bad request (400) response. when try go directly url, receive xml response. here's url i'm trying response with:

https://tst.webservices.outsurance.co.za/securehost/lead/leadpostservice.svc/submitaffiliatelead?xml=%3c%3fxml+version%3d%221.0%22+encoding%3d%22utf-8%22+%3f%3e%0d%0a%0d%0a%3clead%3e%0d%0a+++%3cmode%3elive%3c%2fmode%3e%0d%0a%09%3ctitle%3emrs%3c%2ftitle%3e%0d%0a%09%3cfirstname%3ehannah%3c%2ffirstname%3e%0d%0a%09%3clastname%3edwindle%3c%2flastname%3e%0d%0a%09%3cid%3e1723658492165%3c%2fid%3e%0d%0a%09%3chomecode%3e%3c%2fhomecode%3e%0d%0a%09%3chometel%3e%3c%2fhometel%3e%0d%0a%09%3cworkcode%3e011%3c%2fworkcode%3e%0d%0a%09%3cworktel%3e132189%3c%2fworktel%3e%0d%0a%09%3cmobile%3e0824176239%3c%2fmobile%3e%0d%0a%09%3cemail%3ehannahdwindle@gmail.com%3c%2femail%3e%0d%0a%09%3ccomment%3ethis+is+a+comment%3c%2fcomment%3e%0d%0a%09%3csource%3eupstart%3c%2fsource%3e%0d%0a%09%3cnotes%3ethis+i+a+note%3c%2fnotes%3e%0d%0a%09%3clanguage%3ee%3c%2flanguage%3e%0d%0a%09%3cproduct%3ep%3c%2fproduct%3e%0d%0a%3c%2flead%3e%0d%0a+++++++++ 

i don't kknow now. have tried every solution i've seen on internet no avail.

i wrote this response while back. can give way debug outgoing requests.

it looks http client composing request receiving application doesn't like. can on application level (maybe don't variables , returning 400 level response). i've seen api implementers that. there's nothing stop implementers doing that.

i'd find out exact request you're sending (by link provided) , contact api implementers ensure they're expecting type of request.

also, fiddler, can craft http requests. however, best way craft requests test remote apis manage every byte. can using this method (supports both http , https).

lastly, wrote xml wrapper make xml modification/querying easier, if helps @ all.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -