Hallo,
I need to send a request to a page (POST) and then, I will read the XML and take the logical action.
How can I best send from my PHP request and then read the response. Thnkas.
Hallo,
I need to send a request to a page (POST) and then, I will read the XML and take the logical action.
How can I best send from my PHP request and then read the response. Thnkas.
Hi, from within your php you can use HttpRequest::send http://usphp.com/manual/en/function.httprequest-send.php there are other options too like curl or others.
All of them has a kind of send() method, which will send the request and return the response to you. Than you can parse the response with XMLWriter or other.
You could use the curl library to send the POST request: http://php.net/curl
If all you need is make a simple POST request then no need to use complicated solutions based on curl. PHP streams will support it just fine.
$xml = file_get_contents(
$url,
null,
stream_context_create(array(
'http' => array(
'method' => 'POST'
)
))
);
Then you can use SimpleXML to read the XML.