In my getimage.php file, I have a function that returns an image and an echo statement
function getPicture(){
}
header("Content-Type: image/png");
echo getPicture();
Then in my index.html I have the following code
<body>
<img src="getimage.php" />
</body>
Now obviously I know im doing something wrong, as in the html its a broken picture. I am assuming that setting the src as a .php file doesnt actually execute getimage.php
Any ideas/help?
Thanks!
function getPicture()
{
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, 'image url');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer XXXX'));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$picture = curl_exec($ch);
curl_close($ch);
return $picture;
}