I can not modify an item in mercadolibre with php

0

I have this code which theoretically allows me to modify the stock of an item. He reads it, he does not give an error, but he does not modify it.

<?php 
  $ACCESS_TOKEN="APP_USR-3743017...";
  $uso=1;
  $detallesART = '{"available_quantity":99}';
  $ITEM_ID="MLA663524414";
  $url="https://api.mercadolibre.com/items/$ITEM_ID?access_token=$ACCESS_TOKEN";
  $ch = curl_init($url);
  curl_setopt ($ch, CURLOPT_GET, 1);
  curl_setopt ($ch, CURLOPT_GETFIELDS, $detallesART);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  $respuesta=curl_exec($ch);
  echo "<br>OK:".$respuesta;
  $error = curl_error($ch);
  echo "<br>Error:".$error;
  curl_close ($ch);
?>
    
asked by Diego Ravera 23.05.2017 в 01:28
source

1 answer

1

I think that CURLOPT_GET must CURLOPT_POST , and CURLOPT_GETFIELDS must CURLOPT_POSTFIELDS because CURLOPT_GET and CURLOPT_GETFIELDS are not options for curl_setopt . Look at the documentation on php.net: link

    
answered by 23.05.2017 в 05:12