I'm trying to open read a page on my own website for a search engine I'm trying to get working.
I've tried several ways of doing it:
file_get_contents
$temp = file_get_contents("http://www.mysite.com/example01/");
echo $temp;
döner:
Warning: file_get_contents(http://www.mysite.com/example01/) [function.file-get-contents]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\inetpub\wwwroot\mysite\example01\temp.php on line 66
curl
function curl($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true); // Display headers
curl_setopt($ch, CURLOPT_VERBOSE, true); // Display communication with server
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
print "<pre>\n";
print_r(curl_getinfo($ch)); // get error info
echo "\n\ncURL error number:" .curl_errno($ch); // print error info
echo "\n\ncURL error:" . curl_error($ch);
print "</pre>\n";
return curl_exec($ch);
curl_close($ch);
}
$temp = curl("http://www.mysite.com/example01/");
echo "'$temp'";
döner:
Array ( [url] => http://www.jlwarranty.com/example01/ [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => 0 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0 [namelookup_time] => 0 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => 0 [upload_content_length] => 0 [starttransfer_time] => 0 [redirect_time] => 0 )
cURL hata numarası: 0
cURL hatası:
''
o yeniden sayfayı almak için yaklaşık 30 saniye sürer.
cURL php.ini etkindir ve böylece allow_url_fopen edilir.