Zubrag.com
September 19, 2019, 03:14:17 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to set timeout for file_get_contents (socket timeout)  (Read 18867 times)
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« on: April 23, 2007, 03:25:47 PM »

You may need to set timeout on http request in case remote host is not responding.
Set the socket timeout as follows:

// set socket timeout
ini_set('default_socket_timeout', 120);

// read page contents
$request = file_get_contents("http://www.zubrag.com");

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC