Is it possible to get partial response using PHP cURL? -


here code

 $url = "partial_response.php";  $sac_curl = curl_init();  curl_setopt($sac_curl, curlopt_httpget, true);  curl_setopt($sac_curl, curlopt_url, $url);  curl_setopt($sac_curl, curlopt_returntransfer, true);  curl_setopt($sac_curl, curlopt_header, false);  curl_setopt($sac_curl, curlopt_timeout, 11);  $resp = curl_exec($sac_curl);   curl_close($sac_curl);  echo $resp; 

partial_response.php

header( 'content-type: text/html; charset=utf-8' ); echo 'job waiting ...<br />'; for( $i = 0 ; $i &#60; 10 ; $i++ ) { echo $i . '<br/>'; flush(); ob_flush(); sleep(1); } echo 'end ...<br/>'; 

from code trying partial response partial_response.php. want is, need curl return me "job waiting.." alone instead of waiting partial_response.php complete loop , return entire data. when reduce curlopt_timeout below 11 dont response @ all. kindly clarify doubt. in advance.

i later realized curl not want, used stream_context_get_options achieve wanted. here is, http://www.php.net/manual/en/function.stream-context-get-options.php.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -