tags:

views:

98

answers:

3

i use file_get_contents() to get dinamic data. here is my script...

$str = file_get_contents("http://cba.am/");
some script here...

it works fine for a long time, but now it returns Connection timed out.

and what is strange, when i run the script from local server, it works fine.

could you tell me why, and what can i do, to solve this. maybe i must set the higher timeout time in php.ini?

Thanks

+2  A: 
Sarfraz
@Sarfraz Ahmed you're true. Thanks much, but can you explain such behavior?
Syom
@Syom: I am not a server stuff expert but i suspect it has to do with server settings that site is running on.
Sarfraz
+2  A: 

The timeout for file_get_contents can be controlled with the following setting:

ini_set('default_socket_timeout', 60);
frame
+2  A: 

Their server is simply not configured to respond without the www. It only responds to requests for www.cba.am, thus the timeout.

jfoucher