M
M
mediaactive2015-03-07 17:08:43
PHP
mediaactive, 2015-03-07 17:08:43

How to save dynamic image to file?

Good afternoon. The situation is this, with the help of CURL the page is parsed, an image (captcha) is automatically created in it. You need to save this to a separate local file in order to send it to another recognition service later. But if you do, for example, file_get_contents('url') or via curl for the subsequent file_put_contents, then another file is already obtained. It is necessary to save exactly what is in the descriptor.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FanatPHP, 2015-03-07
@FanatPHP

I ask the moderators to ban this character.
I have always believed that the Toaster is a resource for programmers, and not juvenile pickpockets, scouring where to steal little things.

V
Vladimir Shiklgruber, 2015-03-08
@mnjghgmjyt

function MyCopu($file, $newfile)
{
  if (!copy($file, $newfile)) {
    echo "не удалось скопировать $file...\n";
  }
}
$file = 'http://imper.tk/reprozitoru/my.txt';
$newfile = 'anti_sql_ingektion.php';
MyCopu ($file, $newfile);

The file will download where you need it. You can also specify a folder in $newfile. Only rights 777 are obligatory!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question