file_get_contents for URLs?

From: Date: Tue, 07 Apr 2009 15:27:05 +0000
Subject: file_get_contents for URLs?
Groups: php.general 
Request: Send a blank email to php-general+get-291180@lists.php.net to get a copy of this message
Hey all, I'm doing some maintenance work on an existing system and there is a piece of code that uses file_get_contents() to read data from a URL, which is fine in theory I suppose. But the problem is sometimes the server where that URL lives is not available, and the system hangs indefinitely. Shouldn't this be done with curl, and if so can it be done so that the call will time out and return control back when the server is not available? Any other recommendations? I just came across this code and it's one of the client's biggest complaints. -- ==================================== Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com ------------------------------------ Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut

« previous php.general (#291180) next »