Reply to Re: How to strip header section from an HTML page?

Your name:

Reply:


Posted by Dave on 11/18/22 11:43

You can either do:

1.)
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
$headers=curl_exec($ch);
curl_close($ch);

or
2.) if you also need the html part:

curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$source = curl_exec($ch);
curl_close($ch);

// then split the returned source at adistinct place such as: <!DOCTYPE...
$source_array=split("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01
Transitional//EN\">",$source);
$headers=$source_array[0];
// add back the string we used to split the source:
$html="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" .
$source_array[1];


"Stephen Kay" <sk@karma-lab.nospam.com> wrote in message
news:C04EE2FA.5ADD5%sk@karma-lab.nospam.com...
>I have an html page returned from a curl session in a variable. I want to
> strip off the header portion of the file and replace with a new header.
>
> It seemed to me that this is probably a well-known thing to want to do,
> but
> before I try to write the code myself, anyone have any code examples of
> how
> to do this?
>
> Thanks!
> --
> Stephen Kay
> Karma-Lab sk@karma-lab.NOSPAM.com
> ^^^^^^^
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация