CURLOPT_POSTFIELDS是空的PHP 7

时间:2016-08-25 14:12:13

标签: vk

photos_list始终为空。我不知道为什么。

$upload_url = $_POST["upload"];
$upload_file = 'https:/addr.addr/addr/9509.jpeg';
also if I use
$cfileN = new CURLFile($upload_file, 'image/jpeg',$upload_file);

$imgdata = array('file1' => $upload_file);
or $imgdata = array('file1' => $cfileN);
$curl = curl_init();
$data_string = http_build_query($imgdata);
curl_setopt($curl, CURLOPT_URL, $upload_url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($curl, CURLOPT_SAFE_UPLOAD, true);

$response = curl_exec($curl);
$json = json_decode($response);

curl_close($curl);

答案是

(
    [server] => numbers
    [photos_list] => []
    [aid] => number
    [hash] => string
)

0 个答案:

没有答案