Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    extracting data out of a url

    hello

    i am a beginner in php
    and i need your help

    i want to extract data out of a url

    the url is for example ( not necessarily ) http://www.imdb.com/title/tt1024648/

    i want to extract exactly :
    The movie name (here) is : Argo (2012)
    The length : 120 min
    The genre ( only the first one ) : Drama ( only Drama not | History | Thriller )
    The release date : 12 october 2012
    Rating : 8
    Description : A dramatization of the 1980 joint CIA-Canadian secret operation to extract six fugitive American diplomatic personnel out of revolutionary Iran.
    Stars :Ben Affleck, Bryan Cranston, John Goodman
    The poster url : http://ia.media-imdb.com/images/M/MV...0,214,317_.jpg



    all that i did is to limit the page with this code

    PHP Code:
    <?php

    $h
    =fopen('s.txt','r');
    $contents fread($hfilesize('s.txt'));
    $parts=explode('<time itemprop="duration" datetime=',$contents);
    $part1=$parts[1];
    $part =explode('See full cast and crew',$part1);
    echo 
    $part[0];

    ?>
    can you help , i think it is done using DOM

  • #2
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    it's way simpler to use file_get_contents($url); to get online document.
    but to the point: http://php.net/manual/en/class.domelement.php
    you'll find bunch of examples there.
    but that's not the way to go. instead extracting data from a website, use API.

  • #3
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts
    thanks man
    i didn't think that there is an API
    simple search in google and i found it
    here is what i want
    http://imdbapi.org/?title=argo&type=...iness=0&tech=0


  •  

    Posting Permissions

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