Web Services Examples - listRepository GET::XML Response
<?php
//Web Service needed arguments
$myrepo = 'my-repository'; //Your User Repository name
$mytoken = 'ad46c7f21afc00775be266e77989b686b5fc9c694d7125ae0da17'; //Your Dev Token
$orderby = 'recent'; //Your keyword order (recent or alphabetical)
$mylimit = 0;
$myoffset = 0;
$mymode = 'xml';
//Using the Web Service
$request = 'https://https://www.aptoide.com/webservices/listRepository'.'/private/'.$mytoken.'/'.
$myrepo.'/orderby/'.$orderby.'/'.$mylimit.'/'.$myoffset.'/'.$mymode;
$response = file_get_contents($request);
$xmlobj = simplexml_load_string(html_entity_decode($response)); //XML Object
//Retrieve the data from the XML if 'OK'
// (in this case we're using a simple table to show the contents as an example)
if ($xmlobj->status == 'OK'){
//Create table header
echo '<table>';
echo '<th>Name</th> <th>Path</th> <th>v.Name</th> <th>v.Code</th>';
echo '<th>Package</th> <th>Icon</th> <th>Date</th> <th>md5sum</th> <th>Size (Kb)</th>';
//Build data table
foreach($xmlobj->listing->entry as $row){
echo '<tr>';
echo '<td>'.$row->name.'</td>';
echo '<td>'.$row->path.'</td>';
echo '<td>'.$row->ver.'</td>';
echo '<td>'.$row->vercode.'</td>';
echo '<td>'.$row->apkid.'</td>';
echo '<td><img src="'.$row->icon.'" /></td>';
echo '<td>'.$row->date.'</td>';
echo '<td>'.$row->md5h.'</td>';
echo '<td>'.$row->size.'</td>';
echo '</tr>';
}
echo '</table>';
} else {
//On 'FAIL': Show the error message
echo 'Retrieving listRepository XML failed!<br />';
echo 'Error log:<br />';
foreach($xmlobj->errors->entry as $errlog){
echo $errlog.'<br />';
}
}
?>
//Web Service needed arguments
$myrepo = 'my-repository'; //Your User Repository name
$mytoken = 'ad46c7f21afc00775be266e77989b686b5fc9c694d7125ae0da17'; //Your Dev Token
$orderby = 'recent'; //Your keyword order (recent or alphabetical)
$mylimit = 0;
$myoffset = 0;
$mymode = 'xml';
//Using the Web Service
$request = 'https://https://www.aptoide.com/webservices/listRepository'.'/private/'.$mytoken.'/'.
$myrepo.'/orderby/'.$orderby.'/'.$mylimit.'/'.$myoffset.'/'.$mymode;
$response = file_get_contents($request);
$xmlobj = simplexml_load_string(html_entity_decode($response)); //XML Object
//Retrieve the data from the XML if 'OK'
// (in this case we're using a simple table to show the contents as an example)
if ($xmlobj->status == 'OK'){
//Create table header
echo '<table>';
echo '<th>Name</th> <th>Path</th> <th>v.Name</th> <th>v.Code</th>';
echo '<th>Package</th> <th>Icon</th> <th>Date</th> <th>md5sum</th> <th>Size (Kb)</th>';
//Build data table
foreach($xmlobj->listing->entry as $row){
echo '<tr>';
echo '<td>'.$row->name.'</td>';
echo '<td>'.$row->path.'</td>';
echo '<td>'.$row->ver.'</td>';
echo '<td>'.$row->vercode.'</td>';
echo '<td>'.$row->apkid.'</td>';
echo '<td><img src="'.$row->icon.'" /></td>';
echo '<td>'.$row->date.'</td>';
echo '<td>'.$row->md5h.'</td>';
echo '<td>'.$row->size.'</td>';
echo '</tr>';
}
echo '</table>';
} else {
//On 'FAIL': Show the error message
echo 'Retrieving listRepository XML failed!<br />';
echo 'Error log:<br />';
foreach($xmlobj->errors->entry as $errlog){
echo $errlog.'<br />';
}
}
?>