Re: Getting source from remote file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6 May 2010 10:47, Auto-Deppe C. Hänsel <c.haensel@xxxxxxxxxxxxx> wrote:
> Hi guys and girls,
>
> okay, this is a dumbnut question I wouldn't bother asking.... but I really
> did hit a spot now where I am totally wedged up in my head and can't think
> straight anymore... so the, I bet easy, answer to my question escapes me.
>
> What I am trying to do is the following:
>
> Read the contents of a remote file via file()
>
> So I do
>
> $content = file($url);
>
> Now $content holds the HTML source of the page.
>
> Now this page has some DIVs in it with a class "myclass123" (just for this
> purpose)
>
> Now I want to get the content of these divs into a variable / some
> variables. No more, no less.
>
> Can anybody please direct me towards the answer? Damn, I must sleep more at
> night, so I can think straight at work....
>
> Any help is very much appreciated! Thanks!
>
> Chris
>

You could parse the document with the DOM classes. Load as a
DOMDocument, then grab what's needed with the relevant methods (you
can use xpath to single out your divs with the right classes).
http://dk2.php.net/domdocument


-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux