Page 1 of 1
Accessing values from dynamic sites
Posted: Thu Oct 18, 2007 6:34 am
by kmk
Is there any solution to retrieve values from dynamic sites in to our site.
I m trying to spidering an auction site. any ideas regarding this please reply...
Posted: Thu Oct 18, 2007 8:05 am
by s.dot
You should receive permission from the auction site, if you don't already have it.
file() or
file_get_contents() along with the use of
preg_match() to find what you're looking for should do you some good.
Posted: Thu Oct 18, 2007 9:30 am
by thewebdrivers
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i have written a small function to parse pages. hope that will help you.
Code: Select all
function str_between($str,$start,$end) {
if (preg_match_all('#' . preg_quote($start) . '(.*?)' . preg_quote($end) . '#s',$str,$matches)) {
return $matches[1];
}
// no matches
return false;
}
use it like this
Code: Select all
$data_mac = file_get_contents("http://www.yoururl.com/");
//die();
$start='<td valign="top" class="details">';
$end='<p class="availability">';
$arr_data=str_between($data_mac,$start,$end);
$arr_data will have all the returned results in an array.
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]