Hello.
You need to implement loading by URL (not local file) using cURL.
Developments:
curl_setopt($ch, CURLOPT_POSTFIELDS, array('file'=>"http://site.ru/image.jpg"));
But this code does not work.
Hello.
You need to implement loading by URL (not local file) using cURL.
Developments:
curl_setopt($ch, CURLOPT_POSTFIELDS, array('file'=>"http://site.ru/image.jpg"));
But this code does not work.
In your case, you must first upload a picture to the site skript.ru for example:
$ch = curl_init(); $file = fopen('image.jpg', 'w'); curl_setopt($ch, CURLOPT_FILE, $file); curl_setopt($ch, CURLOPT_URL, 'http://site.ru/image.jpg'); curl_exec($ch);
And then upload to site1.ru.
Or you can do this:
create a script on site site1.ru that will wait for some post parameters (for example, 'file' => 'image address') and after receiving the image address, it will download it with the above-described piece of code.
PS
curl_setopt($ch, CURLOPT_POSTFIELDS, array('file'=>"http://site.ru/image.jpg"));
You here transmit the address of the picture and not the picture itself.
Source: https://ru.stackoverflow.com/questions/169598/
All Articles