I have a client in php who make an http get request to a server. that's the code:
client
<?php
function xml_post($xml_request)
{
$url="http://localhost/malakies/server.php?xml=" . urlencode($xml_request);
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result=curl_exec($ch);
if (curl_errno($ch)){
$ERR .= "cURL ERROR: ".curl_errno($ch).": ".curl_error($ch)."\n";
}
return $result;
}
$result=xml_post("Send sth");
echo $result; ?>
and the server code:
<?php
$postdata = $_GET['xml'];
echo $postdata; ?>
All work perfect. But i have a question that it may be a rookie one:) I want in the server side to have sth like a listener that listens when an http get request have come and do sth with this request. i don't know if http request is the technique that gives me an option like this.. i want sth like that:
while(http request hasn't come yet)
just wait;
do sth with the http request.
Thank you in advance.