SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    Earth
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question getting the data from the url

    hi,

    is it possible to get the data from the given url??

    i had write some code to do that?? but it is giving me an error like
    Warning: file_get_contents(http://www.hollywood.com/movies/detail/id/2419370): failed to open stream


    the code is as follows:
    PHP Code:
    <?php
    $url
    =urldecode("http%3A%2F%2Fwww.hollywood.com%2Fmovies%2Fdetail%2Fid%2F2419370");
    echo 
    $url;
    $file file_get_contents($url);
    echo 
    $file;
    ?>
    so anybody is having any idea about that??

  2. #2
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may have allow_url_fopen disabled, see http://php.net/manual/en/ref.filesys...llow-url-fopen for more info. Apart from that the code is good

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    Earth
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi markl999

    i hav checked that allow_url_fopen it is enabled.

    regards

    amit

  4. #4
    Passionate Web Developer Egyptechno's Avatar
    Join Date
    Jan 2004
    Location
    Dubai
    Posts
    259
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?
     $url 
    "http%3A%2F%2Fwww.hollywood.com%2Fmovies%2Fdetail%2Fid%2F2419370";
       
    $fp fopen ($url,"r");
       
    $site fread($fp,99999999999999);
    echo 
    "<textarea cols=30 rows=30>$site</textarea>";
    observe that .. if you did :
    // echo $site;

    directly .. it will be like a copy of the website / url

    you can use regular expressions to get your data

  5. #5
    SitePoint Enthusiast mutant's Avatar
    Join Date
    Apr 2004
    Location
    Gallifrey
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use snoopy for http/browser style operations, while not the best case of OO coding (no get/set methods) it typically works flawlessly for me.

    http://snoopy.sourceforge.net/

    FYI - your sample code worked fine for me.


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
  •