I am Using Whatsapp Media API to get Image send from user to business number using webhooks and I also get the Image ID and URL and Image as well in Postman but when I use that curl request made from Postman it always shows Facebook error:

Sorry, something went wrong. We're working on it and we'll get it fixed as soon as we can.

But its working fine in Postman what am I doing wrong?

<?php $ua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.16 (KHTML, like Gecko) \  Chrome/24.0.1304.0 Safari/537.16'; $curl = curl_init(); curl_setopt_array($curl, array(   CURLOPT_URL => 'Image_URL_from_Api',   CURLOPT_USERAGENT => $ua,   CURLOPT_RETURNTRANSFER => true,   CURLOPT_ENCODING => '',   CURLOPT_MAXREDIRS => 10,   CURLOPT_TIMEOUT => 0,   CURLOPT_FOLLOWLOCATION => true,   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,   CURLOPT_CUSTOMREQUEST => 'GET',   CURLOPT_SSL_VERIFYPEER => false,   CURLOPT_HTTPHEADER => array(     'Authorization: Bearer My_Token'   ), )); $response = curl_exec($curl); curl_close($curl); echo $response; 

Tag:php, curl, facebook

Only one comment.

  1. osama developer

    OK, I've got the answer I needed to give the user_agent value which is in postman it is automatically putting CURLOPT_USERAGENT => 'PostmanRuntime/7.26.10' in the header but for curl, I've added CURLOPT_USERAGENT => 'curl/7.64.1', and it worked.

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent

Add a new comment.