Re: GetElementByClass?
| From: | Adam Richardson | Date: | Sat, 03 Apr 2010 15:09:36 +0000 |
| Subject: | Re: GetElementByClass? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-303768@lists.php.net to get a copy of this message | ||
>
> <p class="question">
> Who is Roger Rabbit?
> </p>
>
> My question is -- how can I extract the string "Who is Roger Rabbit?" from
> each page using php? You see, I want to store the questions in a database
> without having to re-type, or cut/paste, each one.
>
I have not found/created a working example of this using PHP. I tried using
> PHP's getElementByID(), but that requires the target file to be valid xml
> and the string to be contained within an ID and not a class. These pages do
> not support either requirement.
>
> Additionally, I realize that I can load the files and parse out what is
> between the <p> tags, but I was hoping for a "GetElementByClass" way to do
> this.
>
> So, is there one?
>
Perhaps I'd try this:
http://simplehtmldom.sourceforge.net/manual.htm
<http://simplehtmldom.sourceforge.net/manual.htm>Adam
--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com