Jump to content

Lifting Variable Info from a Webpage


e1seix

Recommended Posts

I have a bit of a loose question, which I'm sad to say the answer is probably "No" but I wanted some advice.

 

Is there a way of lifting variable information from an external website using PHP?

 

An example:

 

I have an affiliate site which links to various product websites. The external websites continually vary the prices of certain products meaning that I have to keep an eye on this and update it in MySQL. An effort when you've over 700 products to keep track of from day to day.

 

Is there a way of scanning the related link's source code for the text, say "Our Price £27.50" and having this update mysql automatically...

 

I know how to do the update bit, but the scanning thing is a big question mark for me... hmm...

 

thank you and a happy new year :)

Link to comment
https://forums.phpfreaks.com/topic/83732-lifting-variable-info-from-a-webpage/
Share on other sites

What you'll need to do is design a script which downloads the HTML. You can use cURL or file_get_contents (the latter being easier).

 

Then, you'll want to use regex (regular expressions) to filter the HTML anything like $27.50. You'll want to make that a variable which you can then update mySQL with.

 

I do't know Regex, but from what I've read, its quite straightforward and logical.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.