anthony

Members
  • Content Count

    9
  • Joined

  • Last visited

About anthony

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. es igual me sale el error porfavor alguien que nos ayude
  2. el token si me cambia varia cada vez que quiero colgar un producto ?? Ahora me e confundido mas el problema es en la post api.mercadolibre.com/items/
  3. tengo el mismo problema ese es mi codigo de mi sdk php alguien podria ayudarme necesito presentar mi trabajo es como una tesis para mi instituto :(
  4. <div class="row"> <div class="col-sm-6 col-md-6"> <h3>oAuth</h3> <p>First authenticate yourself. Authentication is the key to get the most ouf Mercado Libre's API.</p> <?php $meli = new Meli($appId, $secretKey); if($_GET['code'] || $_SESSION['access_token']) { // If code exist and session is empty if($_GET['code'] && !($_SESSION['access_token'])) { // If the code was in get parameter we authorize $user = $meli->authorize($_GET['code'], $redirectURI); // Now we create the sessions with the authenticated user $_SESSION['access_token'] = $user['body']->access_token; $_SESSION['expires_in'] = time() + $user['body']->expires_in; $_SESSION['refresh_token'] = $user['body']->refresh_token; } else { // We can check if the access token in invalid checking the time if($_SESSION['expires_in'] < time()) { try { // Make the refresh proccess $refresh = $meli->refreshAccessToken(); // Now we create the sessions with the new parameters $_SESSION['access_token'] = $refresh['body']->access_token; $_SESSION['expires_in'] = time() + $refresh['body']->expires_in; $_SESSION['refresh_token'] = $refresh['body']->refresh_token; } catch (Exception $e) { echo "Exception: ", $e->getMessage(), "\n"; } } } echo '<pre>'; print_r($_SESSION); echo '</pre>'; } else { echo '<p><a alt="Login using MercadoLibre oAuth 2.0" class="btn" href="' . $meli->getAuthUrl($redirectURI, Meli::$AUTH_URL[$siteId]) . '">Authenticate</a></p>'; } ?> </div> <div class="col-sm-6 col-md-6"> <h3>Get site</h3> <p>Make a simple GET to <a href="https://api.mercadolibre.com/sites">sites resource</a> with your <b>$site_id</b> to obtain information about a a site. Like id, name, currencies, categories, and other settings.</p> <p><a class="btn" href="../examples/example_get.php">GET</a></p> </div> </div> <hr> <div class="row"> <div class="col-md-6"> <h3>Publish an Item</h3> <p> This is a example of how to list an item in <b>MLB</b> (Brasil). <br /> <b>You need to be authenticated to make it work.</b> <br /> To be able to list an item in another country, <a href="https://github.com/mercadolibre/php-sdk/blob/master/examples/example_list_item.php">please update this file</a>, with values according to the site Id where your app works, like <b>category_id</b> and <b>currency</b>. <br /> </p> <pre class="pre-item"> "title" => "Celular PHONE 7 ", "category_id" => "MPE1648", "price" => 10, "currency_id" => "PEN", "available_quantity" => 1, "buying_mode" => "buy_it_now", "listing_type_id" => "free", "condition" => "new", "description" => "Item de Teste. Mercado Libre's PHP SDK.", "video_id" => "Q6dsRpVyyWs", "warranty" => "12 month", "pictures" => array( array( "source" => "https://upload.wikimedia.org/wikipedia/commons/thumb/6/64/IPhone_7_Plus_Jet_Black.svg/440px-IPhone_7_Plus_Jet_Black.svg.png" ), array( "source" => "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/IPhone7.jpg/440px-IPhone7.jpg" ) ) ) </pre> <?php $meli = new Meli($appId, $secretKey); if($_GET['code'] && $_GET['publish_item']) { // If the code was in get parameter we authorize $user = $meli->authorize($_GET['code'], $redirectURI); // Now we create the sessions with the authenticated user $_SESSION['access_token'] = $user['body']->access_token; $_SESSION['expires_in'] = $user['body']->expires_in; $_SESSION['refresh_token'] = $user['body']->refresh_token; // We can check if the access token in invalid checking the time if($_SESSION['expires_in'] + time() + 1 < time()) { try { print_r($meli->refreshAccessToken()); } catch (Exception $e) { echo "Exception: ", $e->getMessage(), "\n"; } } // We construct the item to POST $item = array( "title" => "Computación ", "category_id" => "MPE1648", "price" => 8, "currency_id" => "PEN", "available_quantity" => 1, "buying_mode" => "buy_it_now", "listing_type_id" => "free", "condition" => "new", "description" => "Item de Teste. Mercado Libre's PHP SDK.", "video_id" => "", "warranty" => "12 month", "pictures" => array( array( "source" => "https://upload.wikimedia.org/wikipedia/commons/thumb/6/64/IPhone_7_Plus_Jet_Black.svg/440px-IPhone_7_Plus_Jet_Black.svg.png" ), array( "source" => "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/IPhone7.jpg/440px-IPhone7.jpg" ) ) ); $response = $meli->post('/items', $item, array('access_token' => $_SESSION['access_token'])); // We call the post request to list a item echo "<h4>Response</h4>"; echo '<pre class="pre-item">'; print_r ($response); echo '</pre>'; echo "<h4>Success! Your test item was listed!</h4>"; echo "<p>Go to the permalink to see how it's looking in our site.</p>"; echo '<a target="_blank" href="'.$response["body"]->permalink.'">'.$response["body"]->permalink.'</a><br />'; } else if($_GET['code']) { echo '<p><a alt="Publish Item" class="btn" href="/?code='.$_GET['code'].'&publish_item=ok">Publish Item</a></p>'; } else { echo '<p><a alt="Publish Item" class="btn disable" href="#">Publish Item</a> </p>'; } ?> </div> <div class="col-md-6"> <h3>Get started!</h3> <p>Now you know how easy it is to get information from our API. Check the rest of the examples on the SDK, and modify them as you like in order to List an item, update it, and other actions.</p> <p><a class="btn" href="https://github.com/mercadolibre/php-sdk/tree/master/examples">More examples</a></p> </div> </div> <hr>
  5. aya amigo pero cuando me autentifico me genera mi token Array ( [access_token] => EDITADO [expires_in] => 1537311439 [refresh_token] => EDITADO ) y me habilita el boton de publciar el producto estatico
  6. Buenos días, soy de Perú y estoy usando la aplicación de mercado libre para el país, a la hora de publicar un artículo con la melodía de mercado libre me sale este error. el producto estático que subo es este : Array ( [body] => stdClass Object ( [message] => access_token.invalid [error] => Invalid OAuth access token. [status] => 403 [cause] => Array ( ) necesito ayuda ya tengo días investigando este error y no me quedo otra vez que coloque mi problema es este foro