I am trying to reverse engineer an api due to a lack of documentation from our software provider and I need to recreate a curl command in php. The command in question is:
curl -v -X POST -H Accept-Encoding:"gzip" -H deviceId:"someID" -H appBuildDate:"2014-12-11 15:56:52 +0000" -H systemName:"iPhone OS" -H appBuildNumber:"44" -H platform:"iPhone5,2" -H Content-Type:"application/xml" -H model:"iPhone" -H name:"iphone" -H systemVersion:"8.1.2" -H Authorization:"Token someToken" -H appVersion:"6.8" https://soemsub.somedomain.com/ws/orders/search -d "<orderSearch><consigneeSearch /><customerSearch /><shipperSearch scheduledArrivalEarly=\"12/17/2014\" /></orderSearch>"
The only problem I am having is that I'm not sure what options to set for the -d
command.
I have set CURLOPT_POST
to true
and CURLOPT_POSTFIELDS
using:
$query = "<orderSearch><consigneeSearch /><customerSearch /><shipperSearch scheduledArrivalEarly=\"$date\" /></orderSearch>";
curl_setopt($this->curl, CURLOPT_POSTFIELDS, $query);
I have also tried:
curl_setopt($this->curl, CURLOPT_POSTFIELDS, array($query));
And I'm not getting valid responses. Is there a trick to getting this to post correctly? The command I outlined at the top is written as-is in the log file(aside from deviceId and Authorization), but I'm not sure if I can specify a post without a post "name" like I would do in an HTML form. From what I can tell I need to have key=>value
pairs.
Am I missing something? Thanks in advance!