RE: [PHP] Fopen and streams
| From: | firephreek | Date: | Thu, 29 Jan 2004 13:50:31 +0000 |
| Subject: | RE: [PHP] Fopen and streams | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-176197@lists.php.net to get a copy of this message | ||
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:scrown23@earthlink.net]
Sent: Wednesday, January 28, 2004 7:54 AM
To: php-general@lists.php.net
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