Adrian

Members
  • Content Count

    1
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Adrian

  1. Dump de Categorias: try{ // crear el archivo categoriesMLA.json.gzip con 777 en permisos $fp = fopen("categoriesMLA.json.gzip", "w"); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'https://api.mercadolibre.com/sites/MLA/categories/all'); curl_setopt($curl, CURLOPT_FILE, $fp); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); curl_setopt($curl, CURLOPT_TIMEOUT,60); curl_setopt($curl, CURLOPT_SSLVERSION , 1); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); if($httpCode == 404) { echo "algo pasó"; }else { $contents = curl_exec($curl); if($contents!=false) {fwrite($fp, $contents); echo "se guardó con exito"; }else{ echo "vino vacío"; } } curl_close ($curl); fclose($fp); } catch (Exception $e) { var_dump($e->getMessage());