title: Prestashop module remote API request
body: <p>I have a problem with my Prestashop module. I'm trying to send post with order products in hookActionValidateOrder. But if I get an error in API, or it just not working, the customer "confirm order page" is not loading(because it's waiting for API to answer). </p>
  
  <p>The question is: Can I somehow make request send with WORKERS or jobs. Or should make  with ajax code and pass it to the "confirm order page" template, so it would send the request after a user saw a page and it doesn't block with a request. Sorry about my English, I hope you will understand my question</p>
  
  <pre><code>public function hookActionValidateOrder($params)
        {
          if (Configuration::get('MY_API_STATUS') == 1) {
              $id_order = $params['order']-&gt;id;
              $products = $params['order']-&gt;getProducts();
              $data = [];
              $data['account_id'] = Configuration::get('MY_API_ACCOUNT_ID');
              $data['project_id'] = Configuration::get('MY_API_PROJECT_ID');
              $data['order_id'] = $id_order;
              $productsData = [];
              foreach ($products as $productItem) {
                  $product = array();
                  $product['order_id'] = $id_order;
                  $product['project_id'] = $data['project_id'];
                  $product['account_id'] = $data['account_id'];
                  $product['product_id'] = $productItem['product_id'];
                  $product['product_cost'] = Product::getPriceStatic($productItem['product_id']);
                  $product['quantity'] = $productItem['product_quantity'];
                  $productsData[] = $product;
              }
              $data['products'] = $productsData;
              $returned = static::sendData($this-&gt;orderHookUrl, $data);
          }
          return;
      }
  </code></pre>
  
  <p>this is the sendData code</p>
  
  <pre><code>private function sendData($url, $dataJson)
      {
          $payload = json_encode($dataJson);
  
          $ch = curl_init($url);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch, CURLINFO_HEADER_OUT, true);
          curl_setopt($ch, CURLOPT_POST, true);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
  
          curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . Tools::strlen($payload)));
  
          $result = curl_exec($ch);
  
          curl_close($ch);
          return json_decode($result, true);
      }
  </code></pre>
  
  <p>The question how to do that without blocking a hook, so customer can see a confirm page without waiting for respond from api.</p>