this question exact duplicate of:
when type url browser, returns detailed output. however, when try curl request, request returns single empty blank space. why happening?
my code is:
<!doctype html> <?php function fetchdata($url) { $ch = curl_init(); curl_setopt($ch, curlopt_header, 1); curl_setopt($ch, curlopt_verbose, 1); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_failonerror, 0); curl_setopt($ch, curlopt_url, $url); $returned = curl_exec($ch); echo 'errors: ' . curl_errno($ch) . ' ' . curl_error($ch) . '<br><br>'; curl_close ($ch); echo $returned; return $returned; } ); // pulls , parses data. $returned = fetchdata("https://api.500px.com/v1/users?oauth_token=xelrwq6cqitg8siy9kfbpwkj5scdlp33nrva5tzu&oauth_verifier=hbndynqm8bsyuizya4kz&consumer_key=0ovwthqr5j1zyx1cpaa8y0y1aofjbbdtpx85fj42"); var_dump($returned); if(curl_exec($ch) === false) { echo 'curl error: ' . curl_error($ch); }
please use curlopt_header check response headers errors.
Comments
Post a Comment