Amit Kanala Amit Kanala - 9 days ago 6
PHP Question

How to show proper image response by curl

I put this

curl
code from dropbox url with dropbox api

$curl = curl_init();
curl_setopt_array( $curl,
array( CURLOPT_CUSTOMREQUEST => 'POST'
, CURLOPT_URL => 'https://content.dropboxapi.com/2/files/get_thumbnail'
, CURLOPT_HTTPHEADER => array('Authorization: Bearer <ACCESS_TOKEN>','Dropbox-API-Arg: {"path":"/982sw3rdst/photo oct 26, 3 57 35 pm.jpg","size":{".tag":"w640h480"}}')
, CURLOPT_RETURNTRANSFER => 1 // means output will be a return value from curl_exec() instead of simply echoed
, CURLOPT_TIMEOUT => 15 // max seconds to wait
, CURLOPT_FOLLOWLOCATION => 0 // don't follow any Location headers, use only the CURLOPT_URL, this is for security
, CURLOPT_FAILONERROR => 0 // do not fail verbosely fi the http_code is an error, this is for security
, CURLOPT_SSL_VERIFYPEER => 1 // do verify the SSL of CURLOPT_URL, this is for security
, CURLOPT_VERBOSE => 1 // don't output verbosely to stderr, this is for security
) );

$response = curl_exec($curl);
$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
echo($response.'<br/>');
echo($http_code.'<br/>');


But response is not show proper format
&
I want json response with image url

Answer

Try this

echo $string = '<image src="viewSmallImage.php?path_disp=/982sw3rdst/photooct26,35735pm.jpg">';