0
  $dataArray = array("id"=>1234,"stringnumber"=>"123456789");
                        $data_string = json_encode($dataArray);
                        $ch = curl_init('myurl');
                        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
                        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                'Content-Type: application/json',
                                'Content-Length: ' . strlen($data_string))
                        );

                        $result = curl_exec($ch);

When I use dd($result) i see response is string. How can I convert string to json a response?

jane mily
  • 1
  • 1

0 Answers0