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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.