The resource is interpreted as an image, but is transmitted with text like MIME / html, curl, php

I get this error that I have not seen before. I use cURL to try to get the captcha image from my site, but im getting this error instead of the image I want.

if(isset($_GET['captcha'])) {
 $curl->open("GET","https://mydomain.com");
 $curl->exec();

 preg_match('/_mobile_sess=[^;]+/', $curl->getHeaders(), $sess);
 $_SESSION['cookie'] = $sess[0]; 

 preg_match('/ame="authenticity_token" type=\"hidden\" value=\"(.+?)\"/i',$curl->responseText, $tkn);

 $_SESSION['token'] = $tkn[1];
 preg_match('/\/signup\/captcha\/([0-9-a-z]+)\.gif/i', $curl->responseText, $cs);
 $_SESSION['captchaUrl'] = $cs[1];

 $curl->open("GET", "http://mydomain.com" . $cs[0]);
 $curl->cookie = $_SESSION['cookie'];
 $curl->exec();
 echo $curl->responseText;

 die;

}

I set the MIME type as <meta http-equiv="Content-Type" content="image/gif">in my head of my HTML document, but still getting the same problem.

This is the form in which I am trying to display the image.

if(empty($_SERVER['QUERY_STRING'])){
  echo "<center><form method='POST' action='?go'>
  <input  type='hidden' name='nameC' value='- SAFAL -' ><br/>
  <b>User Name</b><br><input name='login' size='30' id='login'    value='safal".rand(111111,9999999)."'><br/>
 <b>Password</b><br><input name='senha' id='senha' size='30' value='".rand()."'><br/>  <br>
 <img src='?captcha'><br/>
 <input name='cs' id='cs' placeholder='Put The Capcha' size='20'  onclick='if(this.value==\"Digite aqui\") this.value=\"\"'><br><br><br>
 <input type='submit' value='Click Here' id='btn'>
 </form>";
}
+4
source share
2 answers

Found this question through Google Search. Adding my example for reference:

If you install background-image: url('../img/sample.png');like this with single quotes, the Chrome / Opera console will also display this warning.

.

+6

('Content-Type: image/gif'); php, .

0

All Articles