RE: [PHP] grabbing source of a URL
| From: | Vail, Warren | Date: | Fri, 10 Dec 2004 18:38:07 +0000 |
| Subject: | RE: [PHP] grabbing source of a URL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-203947@lists.php.net to get a copy of this message | ||
Oops missed part of your question;
> know what function to use to grab the page. for the string
http://us2.php.net/manual/en/function.fopen.php
There are some good samples on the page
$dh = fopen("$url",'r');
$result = fread($dh,8192);
Hope this is what you need.
Warren Vail
> -----Original Message-----
> From: Adam Williams [mailto:awilliam@mdah.state.ms.us]
> Sent: Friday, December 10, 2004 9:56 AM
> To: php-general@lists.php.net
> Subject: [PHP] grabbing source of a URL
>
>
> Hi, I don't know what functions to use so maybe someone can
> help me out.
> I want to grab a URL's source (all the code from a link) and
> then cut out
> a block of text from it, throw it away, and then show the page.
>
> For example, if I have page.html with 3 lines:
>
> <html><head><title>hi</title></head>
> <body>
> <!-- line a -->
> this is line a
> <!-- end line a -->
> <!-- line b -->
> this is line b
> <!-- end line b -->
> <!-- line c -->
> this is line c
> <!-- end line c -->
> </body></html>
>
> i want my php script to grab the source of page.html, strip out:
>
> <!-- line a -->
> this is line a
> <!-- end line a -->
>
> and then display what is left, how would I go about doing
> this? I don't
> know what function to use to grab the page. for the string
> to remove, I
> know I can probably do a str_replace and replace the known code with
> nothing.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>