RE: [PHP] Fopen and streams

2004-01-29 Thread firephreek
Ok, so, I solved the problem, but haven't necessarily figured it out.
I was using fopen() on a unique device, and getting a stream error.
Rewrote the func using the basic example for fsockopen.  I can now get
the data I need without the errors, but now, a new question:

If indeed there was some sort of incompatiblity between the scheme that
fopen() was using to get at my device, where do I start to find out what
kind of scheme I could be using?  Do I hunt down the manufacturer and
get some tech papers on their device?  Or could I / should I use
something like nmap, if that would work at all.   It just now occurred
to me, and I haven't tried it yet.

Secondly, where is a good place to read on the standards and formats
used by these different schemes.  In the fsockopen() func, I made some
writes to 'GET / ' and 'HTTP 1.1' etc... After reading the script, I
understand what these imply, but not the importance, also, what other
commmands are available to me.  Does that all make sense?  
I guess more simply put: How do I know what commands are availble to me
in the different protocals.  HTTP, FTP, UDP, etc...what if I wanted to
get at the data through straight TCP, is that possible?

Lastly, where should I go to read up on how to make my scripts run
faster?  I haven't written anything to large, but I'm generalyy paranoid
about overhead, esp in areas I probably don't need to be worried about.
Silly questions I suppose, like, is it more efficient to echo one long
string or echo parts of it on separate lines.  The latter is easier when
creating tables and such, because I can comment out individual lines to
hunt down bugs.  But does it make a difference in the runtime of the
script?  Etc

Stryder way too early right now Crown

-if God had meant for me to sleep right now, he wouldn't have invented
penguin mints.  Now in Cinnamon!



-Original Message-
From: stryder [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 28, 2004 7:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Fopen and streams


Hi, first time poster here.  

Having some trouble with a line that used to work, but doesn't now.

$pg = fopen(http://$ip/mypage;, r);

Gets me:

Warning: fopen(http://10.1.1.233/mypage): failed to open stream: HTTP
request failed! 

And then it spits out the data from that page anyways.  What's going on
here?  This was working on my other box a few days ago.  
And I've tried it with and without the variable for the ip address/url.

--Stryder

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Fopen and streams

2004-01-29 Thread Mike Migurski
Secondly, where is a good place to read on the standards and formats used
by these different schemes.  In the fsockopen() func, I made some writes
to 'GET / ' and 'HTTP 1.1' etc... After reading the script, I understand
what these imply, but not the importance, also, what other commmands are
available to me.  Does that all make sense?  I guess more simply put: How
do I know what commands are availble to me in the different protocals.
HTTP, FTP, UDP, etc...what if I wanted to get at the data through
straight TCP, is that possible?

Most protocols are documented in RFC's, such as these:
http://www.w3.org/Protocols/rfc2616/rfc2616.html
http://ftp.ics.uci.edu/pub/ietf/http/rfc1945.html
http://www.ietf.org/rfc/rfc0959.txt
http://www.faqs.org/rfcs/rfc768.html
http://www.ibiblio.org/pub/docs/rfc/rfc793.txt

Lastly, where should I go to read up on how to make my scripts run
faster?  I haven't written anything to large, but I'm generalyy paranoid
about overhead, esp in areas I probably don't need to be worried about.
Silly questions I suppose, like, is it more efficient to echo one long
string or echo parts of it on separate lines.  The latter is easier when
creating tables and such, because I can comment out individual lines to
hunt down bugs.  But does it make a difference in the runtime of the
script?  Etc

Knuth's quote, We should forget about small efficiencies, say about 97%
of the time:  premature optimization is the root of all evil, was
probably intended to refer to optimizations like those. I wouldn't worry
about them, especially if shaving a few milliseconds off your script is
going to make it a nightmare to debug or revisit.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Fopen and streams

2004-01-28 Thread stryder
Hi, first time poster here.  

Having some trouble with a line that used to work, but doesn't now.

$pg = fopen(http://$ip/mypage;, r);

Gets me:

Warning: fopen(http://10.1.1.233/mypage): failed to open stream: HTTP
request failed! 

And then it spits out the data from that page anyways.  What's going on
here?  This was working on my other box a few days ago.  
And I've tried it with and without the variable for the ip address/url.

--Stryder


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php