View Full Version : fsockopen()
Dan
December 6th, 2007, 13:53
I have searched all over for this and can't find the answers.
One of my clients wants us to enable fsockopen() for him.
I checked the PHP.ini file and according to that it's On.
Anyone got ideas?
krakjoe
December 6th, 2007, 13:59
<?php
if( function_exists( 'fsockopen' ) )
{
if( ( $sock = fsockopen( 'freewebspace.net', 80, $errno, $errstr ) ) )
{
printf( "Your client is stupid, fsockopen is available and works<Br />\n" );
}
else printf( "Cannot use file descriptor on socket: #%d: %s<br/>\n", $errno, $errstr );
}
else printf( "No fsockopen, please post php.ini on fws for joe to look at<br />\n" );
?>
show show ....
Dan
December 6th, 2007, 14:06
lmao Joe you crack me up man :D
Give me a ticker.
[JSH]John
December 6th, 2007, 14:07
I had a similar problem, ask which port that they're trying to connect to. I found that one of my clients were trying to get shoutcast stats, since the outgoing port wasn't open, it wouldn't work.
Dan
December 6th, 2007, 14:16
Here Joe,
This is the area I was told is the part for it:
;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On
; Define the anonymous ftp password (your email address)
;from="john@doe.com"
; Define the User-Agent string
; user_agent="PHP"
; Default timeout for socket based streams (seconds)
default_socket_timeout = 60
; If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
; auto_detect_line_endings = Off
krakjoe
December 6th, 2007, 14:22
nope, you were told wrong
allow_fopen_url when true ( or On ) will allow such calls as file_get_contents( "http://freewebspace.net" ); when false ( or Off ) will disallow such activity, so file_get_contents ( and it's whole family, file* or f* will only work on local physical files )
default_socket_timeout will affect calls to fsockopen, however you can override this setting with a call to fsockopen at runtime ...
if you upload the code I posted to somewhere on your server and run it in shell or browser the next step will be explained to you ...
Dan
December 6th, 2007, 14:28
I am lost completely now. :D
I will have Richard check it out when he gets online.
Thanks Joe.
[JSH]John
December 6th, 2007, 14:33
Run the code Joe gave you until Richard comes online, you might be able to fix it yourself then. :P
Dan
December 6th, 2007, 14:49
Run it as what?
Dan
December 6th, 2007, 14:51
Oh wait:
http://deisehost.com/test.php
[JSH]John
December 6th, 2007, 14:51
You paste the code into notepad then save as joestest.php or danstest.php, upload to your site then go to http://deisehost.com/danstest.php and paste what shows up.
Dan
December 6th, 2007, 14:55
John;939489']You paste the code into notepad then save as joestest.php or danstest.php, upload to your site then go to http://deisehost.com/danstest.php and paste what shows up.
Read my last post.
:P
krakjoe
December 6th, 2007, 15:06
There ya go then, you have your answer ... your client is stupid, fsockopen is available and it works ....
Dan
December 6th, 2007, 15:13
Nice one. Thanks Joe. Appreciate the help. :)
Richard
December 6th, 2007, 15:51
Guess I'm no longer needed? :P
serverorigin
December 6th, 2007, 16:30
Joe is the man :P
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.