我是PHP / cURL的新手,我需要将这些内容元素添加到CURLOPT_HTTPHEADER
:
Content-Type: application/octet-stream
Content-Disposition: form-data; name="media[]"; filename="http://www.example.com/pic/test.jpg"
PHP:
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: ' . $this->get_DST($status)));
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'status='.rawurlencode($status);
curl_setopt($ch, CURLOPT_URL, $url);
答案 0 :(得分:0)
$headers = array(
'Authorization: ' . $this->get_DST($status),
'Content-Type: application/octet-stream',
'Content-Disposition: form-data; name="media[]"; filename="http://www.example.com/pic/test.jpg"'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
答案 1 :(得分:0)
$headers = array( 'Authorization: ' . $this->get_DST($status),
'Content-Type: application/octet-stream',
'Content-Disposition: form-data; name="media[]"; filename="http://www.example.com/pic/test.jpg'
);
curl_setopt ($ch, CURLOPT_HTTPHEADER,$headers);