I have some trouble understanding the timeout parameter in the fsockopen function. Could someone please explain to me in even more plain English then the PHP website does what it is used for?
http://se.php.net/manual/en/function.fsockopen.php
fsockopen, not understanding a parameter.
Moderator: General Moderators
Re: fsockopen, not understanding a parameter.
This is the time the script will wait before saying 'cannot connect to the page'
For example, if you set to 60 seconds, you will be able to connect to very slow servers, and only if you cannot establish connection for whole minute, you'll decide that the server is down. If you set to 1 second, only imediate connections will succed.
Is the same as the time your browser waits for a page to load. Think if you can tweak it: if you set to 5 seconds and connection is slow, browser will tell you more often 'can't find the page' and you will not wait for slow pages to load.
For example, if you set to 60 seconds, you will be able to connect to very slow servers, and only if you cannot establish connection for whole minute, you'll decide that the server is down. If you set to 1 second, only imediate connections will succed.
Is the same as the time your browser waits for a page to load. Think if you can tweak it: if you set to 5 seconds and connection is slow, browser will tell you more often 'can't find the page' and you will not wait for slow pages to load.