How to send data to an API in PHP Laravel?
<p>I'm new to Laravel framework so I'm having a hard time to do something very trivial. The main idea is to contact an API and get its response. Below is my function where I'm having error,</p>

<pre><code>public function verification($id=null){
        try{
             $res = $client-&gt;createRequest('POST','http://35.161.181.102/api/socialverify/linkedin',['headers' =&gt; $headers , 'body' =&gt; $urlclean]);  
             $res= $client-&gt;send($res);  
         }catch(\GuzzleHttp\Exception\RequestException $e) {
             \Log::info($e-&gt;getMessage());
             \Log::info($e-&gt;getCode());
             \Log::info($e-&gt;getResponse()-&gt;getBody()-&gt;getContents());
         }
    }
</code></pre>

<p>When I run the above function I'm getting the error shown below,</p>

<pre><code>Illegal string offset 'id'
</code></pre>

<p>Any pointers on what I'm doing wrong and how can I solve it.</p>

<p>Any help is appreciated. Thank in advance.</p>