3.
http://lmgtfy.com/?q=php+curlModerator: General Moderators
hm..., you mean my server or url link server?lalitchand wrote:This message comes when server doesn't return any result.
Thanks,
Lalit
Hi lalitchand,lalitchand wrote:I mean your link server ..
There are two possibilities .. either your Apache server is not configured correctly ..or
if your Apache server is behind some proxy.. then bypass this proxy server..
Hope it helps ..
Thanks,
Lalit
Code: Select all
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_PROXY, "proxy_server");
curl_setopt($ch, CURLOPT_PROXYPORT, "port");
Code: Select all
<?php
error_reporting(E_ALL);
header("content-type: text/xml");
$xmlData = file_get_contents("http://www.google.com/ig/api?weather=new%20york");
echo $xmlData;
function file_get_contents($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
// put here your proxy server ip
curl_setopt($ch, CURLOPT_PROXY, "http://172.18.65.22:80");
// put here your proxy server port
curl_setopt($ch, CURLOPT_PROXYPORT, 80);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?>