RE: [PHP] fopen not opening url
Are you still having problems? Things to try: 1. Try and open the url directly in a browser. eg http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml Does it return data (you may need to change the o=xml to o=html though). Some countries (like the one I'm in China, have moreover access banned via some providers) 2. socket blocking - you may need to enable or disable this dependant on your server settings: set_socket_blocking ($connection,false); function LoadFile ($filename,$block=false){ $fd = fopen( $filename, r ); if ($block) set_socket_blocking ($fd,true); $contents = fread( $fd, filesize( $filename ) ); fclose( $fd ); return ($contents); } Without socket blocking LoadFile (http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml;); With socket blocking LoadFile (http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml,true ); 3. I use something like this for reads on difficult servers (some china mail servers are a p.i.a to get at sometimes). Function GetLine() { $timeout=30; $iStartTime = time(); set_socket_blocking($this-connection, false); $line = fread($this-connection,128); while(empty($line)){ $line = fread($this-connection,128); usleep(25); } if ($debug) { print ($line) .br; System(echo ''); flush; } return ($line); } Let me know how you do. Lawrence. -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: July 31, 2001 5:17 AM To: [EMAIL PROTECTED] Subject: [PHP] fopen not opening url here's the code i'm using below to try and open up the url.. :) thanks! jay $fp = fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml; , r); $length = filesize($fp); $content = fread($fp,$length); fclose($fp); echo $content; - Original Message - From: Jack Dempsey [EMAIL PROTECTED] To: 'Jay Paulson' [EMAIL PROTECTED] Sent: Monday, July 30, 2001 1:52 PM Subject: RE: [PHP] fopen not opening url Hi jay, I've done the exact thing you're trying, and it works...paste in some code so we can see where its going wrong... jack -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP] fopen not opening url hello- I'm trying to use the fopen() command to open the url below and just read it into another $var. However, I'm having some problems the warning i get is below along with the url in the warning. Anyone know what's going on here?? Thanks, jay Warning: php_hostconnect: connect failed Warning: fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso= xml ,r) - Bad file descriptor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fopen not opening url
yeah i've tried opening it directly in a browser and it works fine... i also tried your LoadFile function and the problem is when php calls the fopen() function. It doesn't want to open that file. Here are the errors i get back from PHP: Warning: php_hostconnect: connect failed in d:\files\htdocs\lbjs\new_websites\krox\xml.php on line 24 Warning: fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml; ,r) - Bad file descriptor in d:\files\htdocs\lbjs\new_websites\krox\xml.php on line 24 I have no idea as to why i'm getting these or what they mean. Thanks, jay - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, July 31, 2001 2:01 AM Subject: RE: [PHP] fopen not opening url Are you still having problems? Things to try: 1. Try and open the url directly in a browser. eg http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml Does it return data (you may need to change the o=xml to o=html though). Some countries (like the one I'm in China, have moreover access banned via some providers) 2. socket blocking - you may need to enable or disable this dependant on your server settings: set_socket_blocking ($connection,false); function LoadFile ($filename,$block=false){ $fd = fopen( $filename, r ); if ($block) set_socket_blocking ($fd,true); $contents = fread( $fd, filesize( $filename ) ); fclose( $fd ); return ($contents); } Without socket blocking LoadFile (http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml;); With socket blocking LoadFile (http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml,true ); 3. I use something like this for reads on difficult servers (some china mail servers are a p.i.a to get at sometimes). Function GetLine() { $timeout=30; $iStartTime = time(); set_socket_blocking($this-connection, false); $line = fread($this-connection,128); while(empty($line)){ $line = fread($this-connection,128); usleep(25); } if ($debug) { print ($line) .br; System(echo ''); flush; } return ($line); } Let me know how you do. Lawrence. -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: July 31, 2001 5:17 AM To: [EMAIL PROTECTED] Subject: [PHP] fopen not opening url here's the code i'm using below to try and open up the url.. :) thanks! jay $fp = fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml; , r); $length = filesize($fp); $content = fread($fp,$length); fclose($fp); echo $content; - Original Message - From: Jack Dempsey [EMAIL PROTECTED] To: 'Jay Paulson' [EMAIL PROTECTED] Sent: Monday, July 30, 2001 1:52 PM Subject: RE: [PHP] fopen not opening url Hi jay, I've done the exact thing you're trying, and it works...paste in some code so we can see where its going wrong... jack -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP] fopen not opening url hello- I'm trying to use the fopen() command to open the url below and just read it into another $var. However, I'm having some problems the warning i get is below along with the url in the warning. Anyone know what's going on here?? Thanks, jay Warning: php_hostconnect: connect failed Warning: fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso= xml ,r) - Bad file descriptor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] fopen not opening url
i wish i could help you out, but i tried your code (below) and it worked perfectly... i'm running PHP Version 4.0.4pl1 on a Windows 2000 box. perhaps it isn't the fopen() that's failins. $x = fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml,r;) or die(Cannot open!); print fread($x , 4096); -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 31, 2001 1:40 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] fopen not opening url yeah i've tried opening it directly in a browser and it works fine... i also tried your LoadFile function and the problem is when php calls the fopen() function. It doesn't want to open that file. Here are the errors i get back from PHP: Warning: php_hostconnect: connect failed in d:\files\htdocs\lbjs\new_websites\krox\xml.php on line 24 Warning: fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml; ,r) - Bad file descriptor in d:\files\htdocs\lbjs\new_websites\krox\xml.php on line 24 I have no idea as to why i'm getting these or what they mean. Thanks, jay - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, July 31, 2001 2:01 AM Subject: RE: [PHP] fopen not opening url Are you still having problems? Things to try: 1. Try and open the url directly in a browser. eg http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml Does it return data (you may need to change the o=xml to o=html though). Some countries (like the one I'm in China, have moreover access banned via some providers) 2. socket blocking - you may need to enable or disable this dependant on your server settings: set_socket_blocking ($connection,false); function LoadFile ($filename,$block=false){ $fd = fopen( $filename, r ); if ($block) set_socket_blocking ($fd,true); $contents = fread( $fd, filesize( $filename ) ); fclose( $fd ); return ($contents); } Without socket blocking LoadFile (http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml;); With socket blocking LoadFile (http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml,true ); 3. I use something like this for reads on difficult servers (some china mail servers are a p.i.a to get at sometimes). Function GetLine() { $timeout=30; $iStartTime = time(); set_socket_blocking($this-connection, false); $line = fread($this-connection,128); while(empty($line)){ $line = fread($this-connection,128); usleep(25); } if ($debug) { print ($line) .br; System(echo ''); flush; } return ($line); } Let me know how you do. Lawrence. -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: July 31, 2001 5:17 AM To: [EMAIL PROTECTED] Subject: [PHP] fopen not opening url here's the code i'm using below to try and open up the url.. :) thanks! jay $fp = fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml; , r); $length = filesize($fp); $content = fread($fp,$length); fclose($fp); echo $content; - Original Message - From: Jack Dempsey [EMAIL PROTECTED] To: 'Jay Paulson' [EMAIL PROTECTED] Sent: Monday, July 30, 2001 1:52 PM Subject: RE: [PHP] fopen not opening url Hi jay, I've done the exact thing you're trying, and it works...paste in some code so we can see where its going wrong... jack -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP] fopen not opening url hello- I'm trying to use the fopen() command to open the url below and just read it into another $var. However, I'm having some problems the warning i get is below along with the url in the warning. Anyone know what's going on here?? Thanks, jay Warning: php_hostconnect: connect failed Warning: fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso= xml ,r) - Bad file descriptor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] fopen not opening url
hello- I'm trying to use the fopen() command to open the url below and just read it into another $var. However, I'm having some problems the warning i get is below along with the url in the warning. Anyone know what's going on here?? Thanks, jay Warning: php_hostconnect: connect failed Warning: fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml; ,r) - Bad file descriptor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fopen not opening url
here's the code i'm using below to try and open up the url.. :) thanks! jay $fp = fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso=xml; , r); $length = filesize($fp); $content = fread($fp,$length); fclose($fp); echo $content; - Original Message - From: Jack Dempsey [EMAIL PROTECTED] To: 'Jay Paulson' [EMAIL PROTECTED] Sent: Monday, July 30, 2001 1:52 PM Subject: RE: [PHP] fopen not opening url Hi jay, I've done the exact thing you're trying, and it works...paste in some code so we can see where its going wrong... jack -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP] fopen not opening url hello- I'm trying to use the fopen() command to open the url below and just read it into another $var. However, I'm having some problems the warning i get is below along with the url in the warning. Anyone know what's going on here?? Thanks, jay Warning: php_hostconnect: connect failed Warning: fopen(http://p.moreover.com/cgi-local/page?c=Music%20business%20newso= xml ,r) - Bad file descriptor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]