XMLRPC and file_get_contents
| From: | Andreas Schlicker | Date: | Thu, 16 Aug 2007 12:50:30 +0000 |
| Subject: | XMLRPC and file_get_contents | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-260910@lists.php.net to get a copy of this message | ||
Hi all,
I'm writing an XML-REC client in PHP, based on the following example:
<?php
$request = xmlrpc_encode_request("method", array(1, 2, 3));
$context = stream_context_create(array('http' => array(
'method' => "POST",
'header' => "Content-Type: text/xml",
'content' => $request
)));
$file = file_get_contents("http://www.example.com/xmlrpc", false, $context);
$response = xmlrpc_decode($file);
if (xmlrpc_is_fault($response)) {
trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
print_r($response);} ?> If the XMLRPC call takes longer than say 30 seconds, the file_get_contents method doesn't returns null, and the script finishes. However, the XMLRPC server is not finished with the computation and gets a broken pipe since the client has already closed the connection. Is there some timeout? Am I doing something wrong? Kind regards, Andreas