fork(2) download
  1. <?php
  2.  
  3. $urlBase = "google.com";
  4.  
  5. $xmlString = '<?xml version="1.0" encoding="UTF-8"?'.'>
  6. <prestashop xmlns:xlink="http://w...content-available-to-author-only...3.org/1999/xlink">';
  7.  
  8. // Obtener todos los stocks disponibles con una sola consulta GET
  9. $chGet = \curl_init();
  10. \curl_setopt($curl, CURLOPT_URL, $urlBase);
  11. \curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  12. \curl_setopt($curl, CURLOPT_HEADER, false);
  13. \curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  14. \curl_setopt($curl, CURLOPT_USERPWD, "8QU2PZGRSPJ9HHMCWKDDEUPHMJM7TAMF".':');
  15. $responseGet = \curl_exec($chGet);
  16. $statusGet = \curl_getinfo($chGet, CURLINFO_HTTP_CODE);
  17. \curl_close($chGet);
  18.  
  19. if ($statusGet !== 200 || empty($responseGet)) {
  20. print_r($statusGet);
  21. print_r(curl_error($chGet));
  22. print_r( ["success" => false, "error" => "Error al obtener la data del stock", "response" => $responseGet]);
  23. return;
  24.  
  25. }
  26.  
  27. // Parseamos la respuesta XML para obtener los stocks
  28. $xml = new \SimpleXMLElement($responseGet);
  29. print_r($responseGet);
  30. ?>
  31.  
Success #stdin #stdout #stderr 0.03s 25532KB
stdin
Standard input is empty
stdout
0Array
(
    [success] => 
    [error] => Error al obtener la data del stock
    [response] => 
)
stderr
PHP Notice:  Undefined variable: curl in /home/zFdjOr/prog.php on line 10
PHP Warning:  curl_setopt() expects parameter 1 to be resource, null given in /home/zFdjOr/prog.php on line 10
PHP Notice:  Undefined variable: curl in /home/zFdjOr/prog.php on line 11
PHP Warning:  curl_setopt() expects parameter 1 to be resource, null given in /home/zFdjOr/prog.php on line 11
PHP Notice:  Undefined variable: curl in /home/zFdjOr/prog.php on line 12
PHP Warning:  curl_setopt() expects parameter 1 to be resource, null given in /home/zFdjOr/prog.php on line 12
PHP Notice:  Undefined variable: curl in /home/zFdjOr/prog.php on line 13
PHP Warning:  curl_setopt() expects parameter 1 to be resource, null given in /home/zFdjOr/prog.php on line 13
PHP Notice:  Undefined variable: curl in /home/zFdjOr/prog.php on line 14
PHP Warning:  curl_setopt() expects parameter 1 to be resource, null given in /home/zFdjOr/prog.php on line 14
PHP Warning:  curl_error(): supplied resource is not a valid cURL handle resource in /home/zFdjOr/prog.php on line 21