Dismiss Notice
Welcome to Our Community
Wanting to join the rest of our members? Feel free to sign up today.

how would I code this in php?

Discussion in 'Programming' started by g1siberia, Mar 2, 2009.

  1. g1siberia

    g1siberia New Member Webmaster

    lo all, 1st time here, be gentle :thumbsup:

    I am learning php for fun and have set myself a project to write a php script that when run does this:

    goes to amazon.co.uk
    searches for item you specified eg item number 123456
    'finds' the price on the page
    copies and pastes the current price to a txt file

    the 3rd part, where the code locates the price on the page is probably the trickiest - any suggestions how to go about this?

    thanks :kneeled:
  2. surreypcsupport

    surreypcsupport New Member Webmaster

    You will need to read in the source of the page using fopen() and use the strpos() function to find the start of the part you need and the end of the part you need. Then add the data to a text file or even a mysql db.

    You will need to keep tabs on the position you have reached in the file so you can read on and find the next price.
  3. g1siberia

    g1siberia New Member Webmaster

    wow, great answer, thank you very much :)
  4. satnavdevice

    satnavdevice New Member Webmaster

    If you are an Amazon Affiliate, you can access their data through web services and xml apis, it's so easy instead of extracting from the page source..

Featured Resources (View All)

Share This Page