title: sending file via whatsapp in php
body: <pre><code>
  $photoPath = 'IMG.jpg';
  $getExtension = explode(&quot;.&quot;,$photoPath);
  $base64 = 'data:image/'.$getExtension[1].';base64,'.file_get_contents($photoPath);
  
  
  $data = json_encode(array(
  'chatId'=&gt;$phone.'@c.us',
  'body'=&gt;  $base64,  //how can i make my local image to this URL 
  'filename'=&gt;$filename,
  'caption'=&gt; $caption
  ));
  
  
  $url = $apiURL.'sendFile?token='.$token;
  $options = stream_context_create(['http' =&gt; [
      'method'  =&gt; 'POST',
      'header'  =&gt; 'Content-type: application/json',
      'content' =&gt; $data
  ]
  ]);
  $response = file_get_contents($url,false,$options);
  
  </code></pre>
  <p>I try to send image from my system to WhatsApp client and it works buttt
  the image send in html document and can't open it.. I used Chat API..  so how can I send it in jpg format ?</p>