SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    Mar 2004
    0 Post(s)
    0 Thread(s)

    Question Re: file_get_contents( ) Problem...Please help!!

    Hello, I need help with file_get_contents('http://.../.../...')..

    I have seen other ways of this used, but I don't see it used the way that I need it. I pretty much want to scrape information off of another site, this is totally legal for me with this company I am working with.

    I want to use this or file(http://.../.../.../) or something that will be somewhat easy and somewhat technical at the same time being that I need to have this automated so I can grab results from the site and place to a text file then to a new database in this script....

    I grabbed this off the net to use as an example. I like the way that this works but....
    PHP Code:
                        $lines file('some_page.php');
    foreach (
    $lines as $line_num => $line) {
    "Line #<b>{$line_num}</b> : " htmlspecialchars($line) . "<br />\n";

    but,,,it obviously, reads out the lines from the grabbed html, not certain variables or words in the document(html) that I need.

    Can I add a preg_replace function, or something of this nature, to extract only certain words or phrases that are in this html code. This is kinda like the <title> </title> tag grabbing, but with other phrases or words in the template.

    Last edited by bearslife; Dec 7, 2004 at 09:41. Reason: missed something...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts