i have two servers and i want to display image from my admin server to the client server. i have tried the following:
<img class="pop_image" onclick="window.location.href='<?php echo $pop_rslt['link_to'] ?>'" src="<?php echo imgCurl('odealsdev.in/crons2/fetch_image_by_name.php?name=exit_pop_up/'.$pop_rslt["pop_up_image"]);?>">
this is my client server. And i want to display the image from this location.the fetch_image_by_name.php looks like this
if(isset($HTTP_GET_VARS['name'])){
unset($file_headers);
$file_headers = @get_headers('https://sdev.in/administratie/images/' .$HTTP_GET_VARS['name']);
if($file_headers[0] != 'HTTP/1.1 404 Not Found'){
echo 'https://sdev.ekibo.nl/administratie/images/' .$HTTP_GET_VARS['name'];
}
}
and my curl function looks like this
function imgCurl($url){
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$raw=curl_exec($ch);
curl_close ($ch);
echo $raw;
}
but the main problem i mean the error i get is src='unknown'. pls someone help me to achieve this displaying images from my another server. i had gone through many stack results but non of them helped me to solve this since all are showing to download and display in separate page If i give the header type in curl as image/jpg then my whole page becomes a image type.please someone help me fix this