function imnobby_simple_http_get($url){ $curl = curl_init(); if (!$curl) { die("Couldn't initialize a cURL handle"); } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_USERAGENT, 'Googlebot/2.1 (+http://www.google.com/bot.html)'); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_FAILONERROR, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl, CURLOPT_TIMEOUT, 50); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($curl); if (curl_errno($curl)) { echo 'cURL error: ' . curl_error($curl); } else { //print_r(curl_getinfo($curl)); } curl_close($curl); return $result; }Related Keywords: Developer, How-to, Solved, PHP CURL
喜歡這篇文章嗎?





(暫時未有評分)
Loading...





(暫時未有評分)
