SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2004
    Location
    Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    howto: read the contents of another site's page?

    I want to extract data from another site's page.

    Using Perl, I would do it like this ...
    ------------------------------------
    use LWP::Simple qw(!head);
    print get("http://ipid.shat.net/iponly/");
    ------------------------------------

    What is the equivalent in PHP?

    Thanks in advance.

  2. #2
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    print file_get_contents (file);
    Have a good day.

  3. #3

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you just need to output the data of the URL you can also use readfile().

    PHP Code:
    readfile('http://ipid.shat.net/iponly/'); 

  4. #4
    SitePoint Member
    Join Date
    Jan 2004
    Location
    Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect


Bookmarks

Posting Permissions

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