Read php unbuffered url content

This function reads the 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 can I read an unbuffered cgi- script, for example, to parse it at boot time? How to do this in php?

+3
source share
1 answer

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

+1
source

Source: https://habr.com/ru/post/1778466/


All Articles