Reply to Re: Testing if a server is running with almost no permissions

Your name:

Reply:


Posted by Al on 01/12/06 22:00

As for the original question... If your server has cURL support, try
using that:
It works like fopen with URLs when that feature is disabled.

I stole this from a firefox XML feed ticker code but here's the basic
script:


<?php

function getResponse($url, $port, $timeout) {
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_PORT, $port);

$data = curl_exec($ch);
curl_close($ch);

if ($data === NULL)
return "Error"; // i assume this where you decide if the
server's down or whatever you wanted to do

return $data;
}

$infoFromSite = getResponse("http://www.example.com/", 80, 25);

echo
"<html><head></head><body><pre>".htmlentities($infoFromSite)."</pre></body></html>";

?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация