Hello.
$ link - address of the picture.
$ site - the address to which you upload the image
$url['photo'] = new CURLFile($link); $ch = curl_init($site); curl_setopt($ch, CURLOPT_POST, true); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt($ch, CURLOPT_POSTFIELDS, $url); curl_close($ch); If the $ link is the address of a local (/var/www/olo-lo/123.jpg) picture, then everything works, if it is from the outside, it does not work. How to get a picture via https without saving to the file system and immediately upload it to the required address?
I tried it in different ways, and get the image through file_get_contents () and without it, and use CURLFile () with and without options ... There is only one correct solution. Which one
CURLOPT_URLto specify the address of the appeal serves. - Visman