Click here to Skip to main content
15,568,681 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I try to send multi items to invoice from laravel to another application
but every time I try it goes the same id

What I have tried:

$curl = curl_init();

           curl_setopt_array($curl, array(
         CURLOPT_URL => 'http://',
         CURLOPT_RETURNTRANSFER => true,
         CURLOPT_ENCODING => '',
         CURLOPT_MAXREDIRS => 10,
         CURLOPT_TIMEOUT => 0,
         CURLOPT_FOLLOWLOCATION => true,
         CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
         CURLOPT_CUSTOMREQUEST => 'POST',
         CURLOPT_POSTFIELDS =>'{
         "receiverId": "'.$subject['code'].'",
         "invoiceDate": "",
         "invoiceItems":  [
           {
             "ident": "'.$product['id'].'",
             "quantity": 1
           },
           {
             "ident": "'.$product['id'].'",
             "quantity": 1
           }

         ]
       }',
         CURLOPT_HTTPHEADER => array(
           'Content-Type: application/json',
           'Authorization: Basic UEFXUzoxMjNQQVdTMQ=='
         ),
       ));

       $response = curl_exec($curl);

       curl_close($curl);
       echo $response;
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900