Заливаю фотографию во вконтакте, постоянно получаю пустой photos_list
:
{"server":317823,"photos_list":"[]","aid":114599239,"hash":"3eba9315fef6c796e861d926911993c7"}
Что я делаю не так? Какие-то особые header
надо прописать?
$url = урл, который вернул photos.getUploadServer
$data = file_get_contents("photo.jpg");
function post_req($url, $data){
$data = array('file1' => $data);
$options = array('http' => array(
'method' => 'POST',
'header'=> "Content-type: application/x-www-form-urlencoded; charset=UTF-8;",
'content' => http_build_query($data)));
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
print_r($result);
}