I have been trying to get a web content from a link using PHP. I have tried using file_get_contents()
and curl but both are not working with the link I want. My curl
code is as follows :
function request($url){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($curl);
curl_close($curl);
return $res;
}
echo request("http://...");
This code prints something like ""
This code works with sites like Google but doesn't work with the url I want. However, when I try it with the curl
terminal command, it works from there. What could be the problem ?
Here is the curl -I
output:
HTTP/1.1 200 OK
Date: Mon, 09 Jun 2014 23:47:43 GMT
Server: Apache
Set-Cookie: PHPSESSID=m7fs1ikt47epgoiekg68nnq064; path=/; domain=.sozlukspot.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Powered-By: PleskLin
Connection: close
Content-Type: text/html