Have an account? / Register

Forgot your password?

Forgot your username?

Results 1 to 7 of 7

Thread: Looking for Code which can Parse Product Feed

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Looking for Code which can Parse Product Feed



    Hi everybody,
    i am running mobile affiliate site & like most of the affiliates i am facing the same problem i.e updating feeds
    it keeps on changing on daily basis & the format in which it is provided is not compatible with our database so that i can upload it directly in my database
    i have even asked them i.e my merchants to provide feeds according to the format i need & its almost resolved now but still i need some code which can parse the whole feed if anybody can help me in sorting out this problem then feel free to reply.
    like i want to parse particular 1 coloumn which is something like that
    Sony Eric. K750i for 0.00 when you connect to Orange Your Plan 120 .With this offer you get 6 months at £4.99
    & i want this to be parsed out
    like handset name, plan name, offer, rental everything in seperate coloumn

    Cheers
    Jack

  2. #2
    Driving to win
    Join Date
    Aug 2003
    Location
    If I'm not at home, I'm in hospital
    Posts
    7,370
    Thanks
    7
    Thanked 16 Times in 11 Posts
    Unless the wording follows a regular pattern so that you have words you can 'latch' the parsing on to then splitting a single string as you suggest automatically and reliably is nigh on impossible.

    If the wording does follow a regular pattern then assuming you are using php you should be able to parse it using a combination of strpos and substr statements.
    Never argue with idiots. They just drag you down to their level and then beat you with their experience.

    If ignorance is bliss then some of the people I know must be orgasmic.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Hello Kbudden
    Thanks for replying
    Yeah i am using php & it is not impossible to parse it one can parse it but it will usually take lot of time which i can utilize in promoting my website
    So i am looking for some code which will automatically parse it
    Money is not an issue if somebody is looking to get paid for this i am ready.
    i am repeating that string again which i want to be parsed

    Sony Eric. K750i for 0.00 when you connect to Orange Your Plan 300 .With this offer you get 12 Months Half Price Line Rental

    & this is one of the string from 2000 rows all are in the different row with different plan & incentive but in the same coloumn

    Cheers
    Last edited by CALLOW; 27-02-06 at 05:09 AM.

  4. #4
    more focused this year...
    Join Date
    Nov 2005
    Location
    India
    Posts
    640
    Thanks
    42
    Thanked 15 Times in 15 Posts
    If im not wrong...even i tried getting something like this bt never succeed...
    Let me know if you could get something like this..
    All the best....
    "Falling down is not Defeat....Defeat is when you refuse to get up."

  5. #5
    Registered User
    Join Date
    Mar 2004
    Location
    Stafford, UK
    Posts
    349
    Thanks
    10
    Thanked 18 Times in 14 Posts
    If you could post a few more examples that would help. It's the difference between being impossible (if the text is not predictable) and actually being relatively straight forward.

    Post about 5 examples and we should be able to give more advice...
    Developer of the Price Tapestry Price Comparison Script (now with Voucher Code Feed support and WordPress and Joomla Plugins) and founder of FileHarbour.com FTP proxy for website backup "as you go", file transfer automation and more!

  6. #6
    Registered User
    Join Date
    Dec 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello dmorison
    I am posting some of the strings here from that feed these are from the same coloumn of excel sheet but each in different row

    1. Sony Eric. K750i for 0.00 when you connect to Orange Off Peak 1000 Crossnet .With this offer you get £160 Cashback

    2. Sony Eric. K750i for 0.00 when you connect to Orange 1000 MINUTES OFFPEAK .With this offer you get 7 Months Free Line Rental

    3. Nokia 6230i + Bluetooth for 0.00 when you connect to O2 O2 100 .With this offer you get 5 months free + bluetooth

    4. Motorola V3 + Bluetooth Headset for 0.00 when you connect to O2 O2 200 .With this offer you get 7 Months At £0.99p + Bluetooth

    5.Motorola V3 + Bluetooth Headset for 0.00 when you connect to O2 O2 100 .With this offer you get 7 months Free Line Rental + Bluetooth


    Cheers

  7. #7
    Registered User
    Join Date
    Mar 2004
    Location
    Stafford, UK
    Posts
    349
    Thanks
    10
    Thanked 18 Times in 14 Posts
    It looks like you're in luck - the system generating this feed is apparently combing fields from a database with "standard" text to make an English language description.

    The way I would go about this would be to use a sequence of explode() calls on the known text; (which splits the text into an array); use the first element as the field that you're looking for, and the second as the input to the next itteration. Here's sort of how it would work:
    PHP Code:
    <?php
      $fields 
    = array();  
      
    $record = array();  
      
    // start with the initial description in fields[1] for consistency  
      
    $fields[1] = "Sony Eric. K750i for 0.00 when you connect to Orange Off Peak 1000 Crossnet .With this offer you get &pound;160 Cashback";
      
    // get handset  
      
    $fields explode("for ",$fields[1]);
      
    $record["handset"] = trim($fields[0]);
      
    // get price
      
    $fields explode("when you connect to ",$fields[1]);
      
    $record["price"] = trim($fields[0]);         
      
    // get tariff
      
    $fields explode(".With this offer you get ",$fields[1]);
      
    $record["tariff"] = trim($fields[0]);  
      
    // get bounty (which is what's left, if anything)
      
    $record["bounty"] = trim($fields[1]);      
      
    // display the extracted record
      
    print_r($record);  
    ?>
    In the above script, you end up with $record holding an associative array of the fields parsed out of the description. print_r() is a built in PHP function to display the contents of such an array. The above code outputs something like this:

    Array
    (
    [handset] => Sony Eric. K750i
    [price] => 0.00
    [tariff] => Orange Off Peak 1000 Crossnet
    [bounty] => &#163;160 Cashback
    )

    All you need to do now is turn the above code into a function which accepts the description as input and returns $record and you should be in business. If you don't have the PHP code to read your source file line by line there are plenty of examples on fgets() and fgetcsv() pages at php.net. Please note that it will be quite easy to fool the above example code; so you would be wise to include validation on the output to ensure that it makes sense before use.
    Last edited by dmorison; 27-02-06 at 11:49 AM.
    Developer of the Price Tapestry Price Comparison Script (now with Voucher Code Feed support and WordPress and Joomla Plugins) and founder of FileHarbour.com FTP proxy for website backup "as you go", file transfer automation and more!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Product Feed System Release
    By TD Nick in forum Tradedoubler
    Replies: 26
    Last Post: 09-10-09, 01:44 PM
  2. The Good Feed Guide (For Merchants)
    By clint45 in forum Programming
    Replies: 18
    Last Post: 07-01-09, 10:54 PM
  3. Replies: 0
    Last Post: 25-02-05, 05:44 PM
  4. Product Data Feed System
    By paidonresults in forum Paid On Results
    Replies: 20
    Last Post: 22-12-04, 10:21 AM
  5. eDirectory Affiliates Newsletter
    By Pistol101 in forum Affiliate Future
    Replies: 0
    Last Post: 22-07-03, 08:48 PM

Bookmarks

Posting Permissions

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

SEO by vBSEO 3.6.1