Topic awaiting preservation: Separating HTTP headers from content (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: New Jersey, USA |
posted 09-25-2002 22:41
I know this is going to be one of those slap myself in the forehead and say duh when I hear the answer, but I've been trying to figure this out for a while and I'm just not seeing it. code: <?php
|
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
posted 09-26-2002 01:39
It would depend on the type of file - with a HTML file you could just grab everything between the HTML tags but as you are looking at XML/RSS then you could grab everything after the opening XML tag. So if you were to put it all in a string ($input): code: eregi("<?xml (.*)", $input, $output);
code: while (!feof($fp)) {
|
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
posted 09-26-2002 02:58
For those wondering what a Here Document is (like butcher ): |
Paranoid (IV) Inmate From: Lebanon |
posted 09-26-2002 10:25
Butcher, as far as i remember (<-- AFAIR ? ) , the header and the content are seperated by two \n\r or something like that. |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 09-26-2002 13:31
Thanks lallous, I wasn't sure if that was done universally enough to rely on, but I guess it's really the standard. |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 09-26-2002 14:16
And... |
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
posted 09-26-2002 14:24
lallous: Great idea. I think it might be: |
Paranoid (IV) Inmate From: Lebanon |
posted 09-26-2002 15:17
butcher, check this out: http://www.sloppycode.net/sloppycode/PHP/cs17.html code: function _stripResponseHeader($source)
|
Paranoid (IV) Inmate From: New Jersey, USA |
posted 09-26-2002 17:06
Cool!! |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 09-26-2002 20:08
Okay, one last question on this. code: fputs ($fp, "GET /cgi-local/page?c=Jokes&o=xml_1 HTTP/1.1\r\nHost: p.moreover.com If-Modified-Since: Sun, 22 Sep 2002 07:48:00 GMT\r\n\r\n"); I get some extra characters returned that are after the \r\n\r\n and just before the content starts. There is also a 0 at the end of the results. |