lingray Posted August 20, 2009 Share Posted August 20, 2009 I have been set with the task of writing a PHP script that will go to various websites and check prices of products that we have. Does anybody know of any way of writing this. I have limited knowledge unfortunatly so any help will be appreciated. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/171148-price-comparison-script/ Share on other sites More sharing options...
play_ Posted August 20, 2009 Share Posted August 20, 2009 This probably isn't the best way, but.. maybe screen scrapping? seems like a daunting task you got there Quote Link to comment https://forums.phpfreaks.com/topic/171148-price-comparison-script/#findComment-902550 Share on other sites More sharing options...
lingray Posted August 20, 2009 Author Share Posted August 20, 2009 Yeah and what makes it worse is I don't really understand PHP. I think the best way that I could do it would be to use google shopping as all the data locations are consistent. However, I'm unsure of where to start. I understand the theory behind it but don't really know how to put it to work. To start with select all the models from our database then dump them to a file then a separate script to put the model into the search bar and pull the price etc. Would this be the correct way of going about it? Quote Link to comment https://forums.phpfreaks.com/topic/171148-price-comparison-script/#findComment-902558 Share on other sites More sharing options...
Maq Posted August 20, 2009 Share Posted August 20, 2009 If you do a search on phpfreaks for "scraping", the results should yield some helpful examples. Tutorials can be found on the web: http://www.merchantos.com/makebeta/php/scraping-links-with-php/#curl_content Quote Link to comment https://forums.phpfreaks.com/topic/171148-price-comparison-script/#findComment-902585 Share on other sites More sharing options...
play_ Posted August 20, 2009 Share Posted August 20, 2009 This is ridiculous though. He said 'various' sites. So he's going to have to scrape all these sites, which could take some time. And if a site changes it's html/css code, theres a chance it'll break. Yeah and what makes it worse is I don't really understand PHP. I think the best way that I could do it would be to use google shopping as all the data locations are consistent. However, I'm unsure of where to start. I understand the theory behind it but don't really know how to put it to work. To start with select all the models from our database then dump them to a file then a separate script to put the model into the search bar and pull the price etc. Would this be the correct way of going about it? That would work. then you run a loop that searches the site for each model. Most likely the results of the sites will be shown in different pages (pagination). that would be the hardest part to overcome, i think. Quote Link to comment https://forums.phpfreaks.com/topic/171148-price-comparison-script/#findComment-902655 Share on other sites More sharing options...
Maq Posted August 20, 2009 Share Posted August 20, 2009 This is ridiculous though. Without access, there really isn't any other way... cURL or file_get_contents and regex or an xml parser. He said 'various' sites. Yes, I know. And if a site changes it's html/css code, theres a chance it'll break. Again, without access to their information that's a risk he'll have to take. then you run a loop that searches the site for each model. Most likely the results of the sites will be shown in different pages (pagination). that would be the hardest part to overcome, i think. It all depends on their structure. Most likely you're going to have to use cURL. Quote Link to comment https://forums.phpfreaks.com/topic/171148-price-comparison-script/#findComment-902660 Share on other sites More sharing options...
play_ Posted August 20, 2009 Share Posted August 20, 2009 btw i wasn't saying 'this is ridiculous' to your response, but to the task of the OP. Anyhow, if his server doesn't have curl, here's an alternative http://www.bradino.com/php/screen-scraping/ Quote Link to comment https://forums.phpfreaks.com/topic/171148-price-comparison-script/#findComment-902668 Share on other sites More sharing options...
Maq Posted August 20, 2009 Share Posted August 20, 2009 btw i wasn't saying 'this is ridiculous' to your response, but to the task of the OP. Sorry if I came off a bit rude, that wasn't my intention. Quote Link to comment https://forums.phpfreaks.com/topic/171148-price-comparison-script/#findComment-902711 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.