New user?
REGISTER NOW!

Returning user?
SIGN IN!


Forgot your password?


It's completely free!

OR

ANDROID DEV
Register here

Forgot your password?


Loading...
OR

You're one step closer to becoming a Aptoider!

We will send you a confirmation email to

In the meantime please continue to the final registration step.


Continue to final step Ups... wrong email...

Need to contact us?

Please insert an email address Password must:<br>- have 8 characters minimum<br>- have one letter<br>- have one number OR one special character (!@#$%*) This url is invalid, please enter an valid one. Use only letters, numbers and/or dashes. No spaces please! Please insert a name Business Name should be smaller than 40 characters. Please insert an address. Please insert an company name. Please insert an valid country. Please insert a valid phone number. Please insert a valid phone number. Please insert an city. Please insert an zip/postal code. Please insert an tax ID / VAT. You must agree with terms of use. You must select one option RETRY JOIN NOW https://www.aptoide.com/phpajax/onboarding.php
This website uses cookies to improve service quality. By browsing this website, you are consenting the use of cookies.
I understand Learn more
OK

Web Services Documentation

Web Services Examples - uploadAppToRepo XML Response

<?php

//Web Service needed arguments
$myrepo = 'my-repository'; //Your User Repository name
$mytoken = 'ad46c7f21afc00775be266e77989b686b5fc9c694d7125ae0da17'; //Your Dev Token
$myapk = '/my-path/my-file.apk'; //Your APK file path
$myapkname = 'My Application'; //Your APK name/title
$myapkdescription = 'My Application does some fancy stuff'; //Your APK description
$myapkcategory = 17; //Your APK category
$myapkrating = 1; //Your APK rating
$myphone = 35199912032; //Your phone (related to the APK - Optional)
$myemail = 'myapk.support@gmail.com'; //Your e-mail (related to the APK - Optional)
$mywebsite = 'https://www.myapk.com'; //Your website (related to the APK - Optional)
$onlyuserepo = 'false'; //Upload only to user repo (true) or upload to apps repository as well (false)
$mymode = 'xml';

//Screenshot files (optional)
$myscreens = array( '/my-path/my-shot1.jpg',
                  '/my-path/my-shot2.jpg',
                  '/my-path/my-shot3.jpg',
                  '/my-path/my-shot4.jpg',
                  '/my-path/my-shot5.jpg'
            );

//Using the Web Service
$request = 'https://webservices.aptoide.com/webservices/uploadAppToRepo';
define('MBOUND', '--------------------------'.microtime(true));
$header = 'Content-Type: multipart/form-data; boundary='.MBOUND;
$file_contents = file_get_contents($myapk);
$content = "--".MBOUND."\r\n".
          "Content-Disposition: form-data; name=\"apk\";
          filename=\""
.basename($myapk)."\"\r\n".
          "Content-Type: application/vnd.android.package-archive\r\n\r\n".
          $file_contents."\r\n";

if (isset($myscreens) && is_array($myscreens)){
   foreach ($myscreens as $screen){
      $screenData = file_get_contents($screen);
      $content .= "--".MBOUND."\r\n".
          "Content-Disposition: form-data; name=\"apk_screenshot[]\";
          filename=\""
.basename($screen)."\"\r\n".
          "Content-Type: image/jpeg\r\n\r\n".
          $screenData."\r\n";
   }
}

$content .= "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"token\"\r\n\r\n".$mytoken."\r\n".
      "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"repo\"\r\n\r\n".$myrepo."\r\n".
      "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"apkname\"\r\n\r\n".$myapkname."\r\n".
      "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"description\"\r\n\r\n".$myapkdescription."\r\n".
      "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"category\"\r\n\r\n".$myapkcategory."\r\n".
      "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"rating\"\r\n\r\n".$myapkrating."\r\n".
      "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"mode\"\r\n\r\n".$mymode."\r\n";

if (isset($myphone)){
   $content .= "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"apk_phone\"\r\n\r\n".$myphone."\r\n".
      "--".MBOUND."\r\n";
}

if (isset($myemail)){
   $content .= "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"apk_email\"\r\n\r\n".$myemail."\r\n".
      "--".MBOUND."\r\n";
}

if (isset($mywebsite)){
   $content .= "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"apk_website\"\r\n\r\n".$mywebsite."\r\n".
      "--".MBOUND."\r\n";
}

if (isset($onlyuserepo)){
   $content .= "--".MBOUND."\r\n".
    "Content-Disposition: form-data; ".
      "name=\"only_user_repo\"\r\n\r\n".$onlyuserepo."\r\n".
      "--".MBOUND."\r\n";
}

$content .= "--".MBOUND."--\r\n";
$context = stream_context_create(array(
                        'http' => array(
                           'method' => 'POST',
                           'header' => $header,
                           'content' => $content
                         ),
                     ));
$response = file_get_contents($request, false, $context);

//Get XML response
$xmlobj = simplexml_load_string(html_entity_decode($response));   //XML Object
echo 'Upload status: '.$xmlobj->status.'<br />';
foreach($xmlobj->errors->entry as $errlog){
   echo $errlog.'<br />';
}

?>