3

This function reads an url

 function get_url_contents($url){
    $crl = curl_init();
    $timeout = 5;
    curl_setopt ($crl, CURLOPT_URL,$url);
    curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
    $ret = curl_exec($crl);
    curl_close($crl);
    return $ret;
}

but I want to read it unbuffered, so I can read an unbuffered cgi-script, e.g., to analyze it while it is loading? How do I do this in php?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Jeremy Gwa
  • 2,333
  • 7
  • 25
  • 31

1 Answers1

1

You could use fsockopen(), such as in the first example given here: http://www.php.net/manual/en/function.fsockopen.php

TheOx
  • 2,208
  • 25
  • 28