Results 1 to 2 of 2

Thread: Pull data from external site

  1. #1
    Join Date
    Apr 2008

    Pull data from external site

    I tried look this up but I couldn't seem to find what I need.

    I want to pull the movie synopsis from Apple.com/trailers pages.

    This seems like it should be fairly easy considering that they are stored in a META tag near the top of each page no matter how it is displayed to the user (some pages use an old layout, some new).

    HTML Code:
    <meta name="Description" content="synopsis_text" />
    If I can get ahold of that line of code I just posted, I know how to split it up with PHP to get just the synopsis text, but I can't seem to figure out how to pull just that meta tag. I'd like to avoid pulling the whole page source if possible.


  2. #2
    Join Date
    Aug 2004
    PHP Code:
    = new DOMDocument();
    $metas $dom->getElementsByTagName('meta');
    $metas as $meta)
    strtolower($meta->getAttribute('name')) == 'description')
    $desc $meta->getAttribute('content');
    If your host does not have allow_url_fopen enabled, you'll probably have to use the cURL functions to grab the HTML content, then use DOMDocument->loadHTML() instead of DOMDocument->loadHTMLFile().
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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