fsockopen, not understanding a parameter.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Crux
Forum Newbie
Posts: 7
Joined: Sat Jan 08, 2011 7:01 am

fsockopen, not understanding a parameter.

Post by Crux »

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
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: fsockopen, not understanding a parameter.

Post by Darhazer »

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.
Post Reply