How To Display The Responce Of Curl In Php

[Solved] How To Display The Responce Of Curl In Php | Php - Code Explorer | yomemimo.com
Question : how to display the responce of curl in php

Answered by : navjot-singh

$response = get_web_page("http://socialmention.com/search?q=iphone+apps&f=json&t=microblogs&lang=fr");
$resArr = array();
$resArr = json_decode($response);
echo "<pre>"; print_r($resArr); echo "</pre>";
function get_web_page($url) { $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_ENCODING => "", // handle compressed CURLOPT_USERAGENT => "test", // name of client CURLOPT_AUTOREFERER => true, // set referrer on redirect CURLOPT_CONNECTTIMEOUT => 120, // time-out on connect CURLOPT_TIMEOUT => 120, // time-out on response ); $ch = curl_init($url); curl_setopt_array($ch, $options); $content = curl_exec($ch); curl_close($ch); return $content;
}

Source : https://stackoverflow.com/questions/6516902/how-to-get-response-using-curl-in-php | Last Update : Sun, 17 May 20

Answers related to how to display the responce of curl in php

Code Explorer Popular Question For Php