how can i reduce fopen's connection timeout when openning a url? i want to test if a url exists or not in the least time.
Perhaps you could try [man]fsockopen/man.
You could use the [man]cURL[/man] functions and with [man]curl_setopt/man specify that you want CURLOPT_NOBODY set to true and CURLOPT_HEADER set to true, too; then check the response headers for a "200 OK".
fsockopen() doesn't make a connection to the specified file as url. so the two addresses bellow returns the same result, while the second doesn't exist.
www.mysite.com/image1.jpg => exists www.mysite.com/image2.jpg => doesn't exist
and cURL is disabled or not easy to use. no way?
$context = stream_context_create(array('http'=>array('timeout'=>42))); $handle = fopen('http://www.example.com/', 'r', false, $context);
thank you.