Answer the question
In order to leave comments, you need to log in
How to extract an image from a page?
Link to the picture with the question "Note" http://site.ru/captcha_question/629
The function copy();
copies and creates an empty text. file_get_contents ----- file_put_contents
the same.
Curl with headers, cookies and everything else opens that picture as if on a PC you open it as a text file:
PNG IHDR9jgAMAasRGB cHRMz&u0`:pQ<bKGD X pHYsHHFk>'WIDATxڵ]y\TDz@My █QFԨƨQ\/qKD# -Gb5nQQ+ ...
echo "<img src='http://site.ru/captcha_question/629' />";
The picture is displayed correctly
Answer the question
In order to leave comments, you need to log in
$img = file_get_contents('http://site.ru/nota.jpg');
file_put_contents('/var/www/site.domain/images/nota.jpg', $img);
echo '<img src="/images/nota.jpg" />';
Solution found.
I found this line with a sniffer: Content-Transfer-Encoding: binary
Then I did this: Encoded and decoded in base64
...
$t1 = curl($cookie, $url_game.'/captcha_question/629', $url_game) or die('Ошибка: 2');
$tr = base64_encode($t1);
$tr = base64_decode($tr);
file_put_contents('img.png', $tr);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question