Results 1 to 3 of 3
  1. #1
    Join Date
    February 8th, 2008
    Very Novice Datafeed Query
    Hi all,

    OK, so I've been pointed in the direction of Dirk Gardner's legendary thread relating to this, but I'm still very confused.

    I have a website that uses two affiliate websites, with two merchants between them - 1 each to be technical.

    I have my website all up and running, but as the products from the merchants prices are frequently changed, I need to update them every day if I'm honest. Some then become not in stock etc also and have to be removed. I have been using regex scripts to lift price directly off each individual page but merchants aren't happy as I'm putting noise traffic through roof for them.

    Both affiliate programs carry the ability to download datafeeds, updated daily and what I need to do is figure out how to, for example...

    if one of the rows on the datafeed table carries the "product_id" of 3434 say, be able to lift the corresponding value in the "price" column from the same row, define it, and subsequently update the "price" in my database where the "product_id" matches the datafeed's "product_id".

    Do you see where I'm going with this? I don't need to lift every column of the datafeed and create a whole new database from this info.

    the datafeed url link is always gonna be a .gz

    Can anyone at all help me or indeed point me in the right direction?

  2. #2
    Grandma broke her coccyx! Uncle Rico's Avatar
    Join Date
    May 8th, 2007
    North Carolina
    The datafeed files have one product per line. Each line is separated by either a pipe | or multiple spaces in a row. Somelike like this ...


    So if you just read the file, you could pick out the specific elements you want.
    //Open the datafeed file
    $fpin  = fopen("datafeed_file", "r");
    //Read each line of datafeed file
    while (!feof($fpin)) {    		
      $buf = fgets($fpin); //Read line into buffer
      $line = explode("|",$buf); //Split line by pipe and throw into array
      $line[2] would be the name of the product
      $line[6] would be the price of the product
    //Close datafeed file descriptor	 
    Last edited by Uncle Rico; February 8th, 2008 at 12:17 PM.

  3. #3
    Join Date
    February 8th, 2008
    I have been given this code by someone, but I can't seem to get it to work. I have defined my feed as xml, but obv it's still .gz

    $xml = simplexml_load_file("");
    $product = $xml->product_id;
    $price = $xml->product_id->price;
    mysql_query("UPDATE table_name WHERE product_id = '$product' SET price = '$price'");

  4. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Novice reported
    By xigua in forum Introduce Yourself
    Replies: 2
    Last Post: August 26th, 2010, 07:24 PM
  2. new novice
    By davey6 in forum Introduce Yourself
    Replies: 4
    Last Post: June 19th, 2010, 07:05 PM
  3. Hello from complete novice..
    By millymcb in forum Introduce Yourself
    Replies: 3
    Last Post: July 13th, 2007, 08:53 AM
  4. Inktomi Novice
    By Dynamoo in forum Search Engine Optimization
    Replies: 2
    Last Post: July 22nd, 2002, 09:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts