views:

46

answers:

1

Hey guys,

I need to be able to get the TITLE and DESCIPTION metadata out of a page.

I've been trying to do this but I've been getting more errors than actual results. (I have an array of about 10 URLS, usually only about 2 of them give me the descrption. I have yet to get the title).

So how do I, in PHP, get the Desc and Title from a remote page, and if there is none or if there's an error, ignore it?

-Dylan

+1  A: 

Use something like cURL (Checking things like the result isn't false and that the HTTP status is 200) to get the page and then Simple HTML DOM to parse it and extract the elements you want. (Remembering that the elements might not exist)

Yacoby