2 Votes Vote

get div around searched keyword (file_get_contents('url')

Posted by topdog 619 days ago Questions| url file contents All

So im creating a webcrawler and everything works, only got 1 problem.

With file_get_contents($page_data["url"]); I get the content of a webpage. This webpage is scanned when one of my keywords excists on the webpage.

$find = $keywords; $str = file_get_contents($page_data["url"]);

if(strpos($str, $find) == true)

When i want to insert the data into mysql-database i only want the info inside the div the keyword is find in.

I know i have to use DOM but i'm new into the domdocument scene.

EXAMPLE: http://crawler.tmp.remote.nl/example.php

Originally asked by: Jordy on Stack Overflow

Discuss Bury


Who Voted for this Question