You are here: Re: html source « PHP Language « IT news, forums, messages
Re: html source

Posted by Rik on 02/16/07 04:23

On Fri, 16 Feb 2007 05:05:41 +0100, yoko <nana@na.ca> wrote:

>> // Get the HTML file
>> $html =3D file_get_contents($url);
>> // Reduce it to the contents of the <body> tag
>> $body =3D preg_replace("#^.*<body[^>]*>(.*)</body>.*$#si", "\\1",
>> $html);
>> // Strip of whitespace at the beginning and the end
>> $body =3D trim($body);
>
> That worked no problems. What about cURL is that a good method as =

> well?

'the body' of the response for CURL is the entire HTML document, just =

without the headers (so _not_ without the html head). No extra =

functionality there to get only the body.

Using cURL is usefull when:
- You're possibly redirected, cURL will follow the redirect if you tell =
it =

to.
- You want to use cookie or post values to get the content.
-- =

Rik Wasmus

 

Navigation:

[Reply to this 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

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