将照片上传到远程服务器PHP

I want to upload a file to a remote which can be downloaded from a url. Below is the code that I used to do that, but the $response that I get says that file is not received in the server end.

$path = "http://image-server/image.jpg";

$ch=curl_init();

curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);

curl_setopt($ch,CURLOPT_URL,"https://my-server/files/images");

curl_setopt($ch,CURLOPT_POST,true);

$post=array("content"=>$path);

curl_setopt($ch,CURLOPT_POSTFIELDS,$post);

$response=curl_exec($ch);

FYI : the file needs to be sent as the value for a parameter(content).

Thanks.

Please take a look at the servers access.log if the request arrives there and then check the error.log if an error occoured.

It might be the SSL Connection. Can you try the post without SSL?

Take a look at this for SSL and cURL:

http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/