Accessing values from dynamic sites

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kmk
Forum Newbie
Posts: 1
Joined: Thu Oct 18, 2007 6:24 am

Accessing values from dynamic sites

Post 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...
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
thewebdrivers
Forum Commoner
Posts: 41
Joined: Fri Aug 17, 2007 3:32 pm
Location: india
Contact:

Post by thewebdrivers »

feyd | Please use

Code: Select all

,

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. :D


feyd | Please use

Code: Select all

,

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]
Post Reply