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.”
tbotelho, Brazil.
Public Clarification Board
How to get started with contests
-
Post Your Contest Quick and easy
-
Get Tons of Entries From around the world
-
Award the best entry Download the files - Easy!