php - get_headers() used on live site is not returning any array but on localhost it is -
when use function get_headers($url) $url = "https://www.example.com/product.php?id=15"
on live site not returning array given url. nothing. when same code used on localhost, following:
array ( [0] => http/1.1 200 ok [1] => cache-control: private [2] => content-type: text/html; charset=utf-8 [3] => server: microsoft-iis/8.5 [4] => set-cookie: asp.net_sessionid=wumg0dyscw3c4pmaliwehwew; path=/; httponly [5] => x-aspnetmvc-version: 4.0 [6] => x-aspnet-version: 4.0.30319 [7] => x-powered-by: asp.net [8] => date: fri, 18 aug 2017 13:06:18 gmt [9] => connection: close [10] => content-length: 73867 )
so, why function not working on live?
edit
<?php if(isset($_post['prdurl'])) { $url = $_post['prdurl']; print_r(get_headers($url)); // not getting array on live on localhost if(is_array(@get_headers($url))) { // code goes here... } else { echo "url doesn't exist!" } } ?>
one more thing note down here i'm using file_get_html
retrieve html page remote url. it's working on localhost not on live well.
Comments
Post a Comment