开发者

How do I transfer data to next server

I am trying to pass some information of a server in which the script is running to next url or server.

I tried using curl. I have following two disadvantages:

  1. if cannot locate file it will tell file not found

  2. it waits till the remote file execution is completed.

How can I overcome both of the things either by using curl or other commands?

Edit:

  1. Now I would like to suppress the file not found message error message being displayed by curl even if the file really doesn't exists.

  2. I do not want output from destination page so I don't want to wait till the execution of the destination page is finished. I just want to trigger the code and continue with another scripts remaining

Example:

I am trying to build a log system which will have its everything in next webserver. The client website which implements the log system will be sending some of the data required for the system by calling a file in my webserver.

Code I am using:

// create a new cURL resource
$ch = curl_init();
// set URL and other approp开发者_JAVA技巧riate options
curl_setopt($ch, CURLOPT_URL, "http://example.com/log.php?data=data");
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);


Why don't you want to use standard PHP features?

<?php
    $logpage = file_get_contents('http://example.com/log.php?data=data');
    echo $logpage;
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜