I want to send a put request to an API which wants the details of the request as XML
Apparently I need to send the xml as a file when using PUT with PHP.
How can I do this?
Here is what I’m trying:
$HttpSocket = new HttpSocket();
$result = $HttpSocket->put($put, $fh);
where $put is the url and $fh is a file i have made on the fly like this
$xmlObject = Xml::fromArray($xmlArray);
$xmlString = $xmlObject->asXML();
$fh = fopen('php://memory', 'rw');
fwrite($fh, $xmlString);
rewind($fh);
I ended up doing this just using php rather than the php helpers
I’d have preferred using the Cake classes for neatness, but this works with the api i was using.