Code: Select all
<?php
$url = "http://www.google.com";
$content = file_get_contents($url);
echo $content;
?>Code: Select all
<?php
$url = "https://www.novaworld.com";
$content = file_get_contents($url);
echo $content;
?>Any ideas?
Moderator: General Moderators
Code: Select all
<?php
$url = "http://www.google.com";
$content = file_get_contents($url);
echo $content;
?>Code: Select all
<?php
$url = "https://www.novaworld.com";
$content = file_get_contents($url);
echo $content;
?>feyd wrote:They've chosen to basically be jerks and filter what user-agent's they will allow. Using cURL, I can easily get the page. The following works as well.Code: Select all
[feyd@home]>php -r "ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6'); var_dump(get_headers('http://www.goalzz.com/main.aspx?region=-1&area=6&update=true'));" array(11) { [0]=> string(15) "HTTP/1.1 200 OK" [1]=> string(17) "Connection: close" [2]=> string(35) "Date: Wed, 09 Aug 2006 18:16:32 GMT" [3]=> string(25) "Server: Microsoft-IIS/6.0" [4]=> string(21) "X-Powered-By: ASP.NET" [5]=> string(26) "X-AspNet-Version: 1.1.4322" [6]=> string(62) "Set-Cookie: ASP.NET_SessionId=cpbavi551sri2w453kvvrx45; path=/" [7]=> string(22) "Cache-Control: private" [8]=> string(38) "Expires: Tue, 09 Aug 2005 18:16:32 GMT" [9]=> string(45) "Content-Type: text/html; charset=Windows-1252" [10]=> string(21) "Content-Length: 78043" }
Code: Select all
<?php
// create a new curl resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://www.novaworld.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
curl_exec($ch);
// close curl resource, and free up system resources
curl_close($ch);
?>perhaps it is a cookie issue?<html><head><title>Object moved</title></head><body><ht>Object moved to <a href='/Players/Search.aspx'>here</a>.</h2></body></html>
Code: Select all
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.novaworld.com/Players/Stats.aspx?id=33680801261&p=616065");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_exec($ch);
curl_close($ch);
?>Code: Select all
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.novaworld.com/Players/Stats.aspx?id=33680801261&p=616065");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt($ch, CURLOPT_PROXY, '193.194.69.66:8080');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_exec($ch);
curl_close($ch);
?>Looks like they've got a 301 redirect set up. cURL can follow them (if you tell it to), file_get_contents() probably can't.SidewinderX wrote:dont work either, and when i do:
#curl https://www.novaworld.com/Players/Stats ... 1&p=616065
on my linux box i get:
<html><head><title>Object moved</title></head><body><ht>Object moved to <a href='/Players/Search.aspx'>here</a>.</h2></body></html>
Now I have no trouble connection to other https sites, but i still have a problem connecting to this one.Hi,
Please check your script now. We have opened outgoing connections to 443 on the server.
Thank you.
Code: Select all
<?php
// create a new curl resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://www.novaworld.com/Players/Stats.aspx?id=33680801261&p=616065");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
curl_exec($ch);
// close curl resource, and free up system resources
curl_close($ch);
?>