XML/CSV Parsing

  • Status: Closed
  • Prize: $60
  • Entries Received: 8
  • Winner: Prakhar01

Contest Brief

We have a small price comparison app, and we are looking for someone to develop 9 XML/CSV parsers, in order to integrate products from different stores in our app.

The goal of this contest is not just to do an occasional work, but rather we expect the winner is available to establish a strong partnership with us in the future.

So we can be sure we choose the right person for the job, we need to do a test. Therefore, we ask all freelancers interested to follow the directions bellow before submitting entries.

We require the development of PHP functions in order to parse xml or csv data. The code is simple and only requires a bit of time.
We'll give you the xml url's or files and the code should follow the example posted below and the guide rules presented as comment.
In case the file is a csv the same rules should be followed.

XML test url:
http://adxml.publicidees.com/xml.php?progid=1985&partid=40814&n=LightintheBox_BR_PT

---

public function lojasmm_parser(){

$xml=simplexml_load_file('http://www.lojasmm.com/xml/jacotei.xml'); //you may use another xml parser if needed(some files are just to big)
$i=1;
foreach($xml->children() as $child)
{

$row=array();
$row['count']=$i;
$row['prodName'] = $child->nome; //product name
$row['prodShortName'] = $child->nome; //product name
$row['brand'] = ''; //brand if available
$row['store'] ='lojasmm'; // short name of the store provided by us
$row['description'] = $child->nome; //description if available and under 200 chars otherwise use product name


$price = $child->preco; //price- remove "," cents should be separated by "." 1,9898.34 becomes 19898.34 and 19898,34 becomes 19898.34


$row['price'] = $price;
$row['pricePre'] = $child->prePreco; //previous price before offer. same rules for price apply

$row['lpUrl'] = $child->link; //product page url
$row['author'] =''; //ignore
$row['imageUrl'] = $child->imagem; // product url image
//barcodes
$row['mpn']=''; //if mpn is available
$row['ean']=''; //if ean is available
$row['upc']=''; //if upc is available
$row['sku']='';// if sku is available
$row['isbn']=''; // if isbn is available
$row['insertTimestamp']=date('Y-m-d h:i:s');
$row['store_int_id'] = $child->codigo.'lmm'; //store unique code. We will provide you a suffix if needed (like lmm)

$valParcel = $child->parcelamento->valor; //payment parcel for product, price rules apply
$valParcel = str_replace(".","", $valParcel);
$valParcel = str_replace(",",".", $valParcel);
$row['valParcel']= $valParcel;
$row['nParcel'] = $child->parcelamento->parcelas; //number of parcels

// $catlimit=array('Sex Shop');

if($row['store_int_id']!=''){
//extra code
}
echo $i.'<br>';


$i++;
}
}

Recommended Skills

Employer Feedback

“Prakhar is an excellent freelancer. He did the job that was supposed to, and was totally open to new challenges. I will definitely hire him again.”

Profile image tbotelho, Brazil.

Public Clarification Board

  • Prakhar01
    Prakhar01
    • 11 years ago

    Hi, I have provided my entry with the relevant screen shots. Also have provided you with the instruction to test it out. You can go to the provided url and test out the solution if it fits your needs. Would love to hear more from you.

    • 11 years ago
    1. tbotelho
      Contest Holder
      • 11 years ago

      Thank you! We will test your solution as soon as possible. :)

      • 11 years ago
  • tbotelho
    Contest Holder
    • 11 years ago

    Hi there Prakhar01, first of all, I want to thank you for your interest.

    Regarding your questions:
    1) www3.strawberrynet.com/productfeed/precosmart/Precosmart_br.csv
    2) at the end of each product iteration an operation will run but you can just echo the product name. We will add the op afterwards.

    • 11 years ago
  • Prakhar01
    Prakhar01
    • 11 years ago

    1) Could you please provide an example of the csv file as well. 2) Is there an operation intended at the end of each iteration of product (array $row[]), like writing to database or putting them in a file?

    • 11 years ago

How to get started with contests

  • Post your contest

    Post Your Contest Quick and easy

  • Get tons of entries

    Get Tons of Entries From around the world

  • Award the best entry

    Award the best entry Download the files - Easy!

Post a Contest Now or Join us Today!