Hello!
I want to add spider type script on my website to read prices from different vendors website from their product page.
Is this possible in PHP or Perl? If yes whats the script or how can i do that?
Regards,
Zeeshan
Spider Type Script in PHP
Moderator: General Moderators
Yup.
file_get_contents() will grab the html source of a particular page. Then you can parse it however you like.
Though I highly recommend looking for an RSS or text feed or joinign some sort of API program the site may offer because this is not exactly the best way to do the job. One layout change on any of the sites and that'll screw up your entire script functionality. Whereas a data source would be a reliable and steady solution which you know won't fail.
file_get_contents() will grab the html source of a particular page. Then you can parse it however you like.
Though I highly recommend looking for an RSS or text feed or joinign some sort of API program the site may offer because this is not exactly the best way to do the job. One layout change on any of the sites and that'll screw up your entire script functionality. Whereas a data source would be a reliable and steady solution which you know won't fail.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
At a basic level file_get_contents() included in some recursive function could spider around websites BUT it doesn't work for more secure sites. For more secure sites you will need to use the cURL library ideally or fall-down to using fsockopen()...
For examples and function reference visit http://www.php.net/
For examples and function reference visit http://www.php.net/
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: