curl run out very slowly.

Posted by sabuj on Stack Overflow See other posts from Stack Overflow or by sabuj
Published on 2010-06-09T12:14:26Z Indexed on 2010/06/09 13:02 UTC
Read the original article Hit count: 153

Filed under:

here is my code bellow:

$url = "http://localhost/Test/post_output.php";

$post_data = array (
    "foo" => "bar",
    "query" => "Nettuts",
    "action" => "Submit"
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);


curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// we are doing a POST request
curl_setopt($ch, CURLOPT_POST, 1);
// adding the post variables to the request
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_VERBOSE, true); // some output will go to stderr / error_log
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt(CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
$errStr = curl_error($ch);
$errNum = curl_errno($ch);
$head = curl_getinfo($ch, CURLINFO_HEADER_OUT);
$ci = curl_getinfo($ch);
print_r(array($head, $errStr, $errNum, $ci)); exit;

curl_close($ch);

echo $output;

This script outputs very slowly. Even outputs nothing...

can anyone help out this. Thanks...

© Stack Overflow or respective owner

Related posts about curl