I am using php 5.4 in CentOs 6.5
I am trying to get response code of a url below is my code snippet
$URL="http://www.bertuccis.com/#menu";
try{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($c, CURLOPT_USERAGENT,'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36');
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
$httpCode = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
echo 'Resp Code ' . $httpCode;
} catch(Exception $ex){
print_r($ex);
}
It returns 404 Http response code. If i try same url in browser, it returns 200 Ok.
I tried using curl -v on terminal of my centos machine but its working
Here is the version info of curl and php-curl
Curl lib in my centos is : curl 7.24.0 (x86_64-unknown-linux-gnu) libcurl/7.24.0
php-curl info in my php info :
cURL support => enabled
cURL Information => 7.19.7
Age => 3
Features
AsynchDNS => No
Debug => No
GSS-Negotiate => Yes
IDN => Yes
IPv6 => Yes
Largefile => Yes
NTLM => Yes
SPNEGO => No
SSL => Yes
SSPI => No
krb4 => No
libz => Yes
CharConv => No
Protocols => tftp, ftp, telnet, dict, ldap, ldaps, http, file, https, ftps, scp, sftp
Host => x86_64-redhat-linux-gnu
SSL Version => NSS/3.15.3
ZLib Version => 1.2.3
libSSH Version => libssh2/1.4.2