Доброго времени суток!
<?php
$token = 'ТОКЕН';
$data = array(
'album_id' => '195826674',
'access_token' => $token
);
$content = file_get_contents('
https://api.vkontakte.ru/method/photos.getUploadServer?'.http_build_query($data));
echo $content;
$json = json_decode($content, true);
$b = 'r4.jpg';
$url = $json['response']['upload_url'];;
$postData['file1'] = '@' . $b;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$response = curl_exec($ch);
curl_close($ch);
$res = json_decode($response);
$server = $res->{'server'};
$photo = $res->{'photos_list'};
$id = $res->{'photo'};
$hash = $res->{'hash'};
$aid = $res->{'aid'};
$gid = $res->{'gid'};
$data = array(
'server' => $server,
'aid' => $aid,
'gid' => $gid,
'hash' => $hash,
'photos_list' => $photo,
'access_token' => $token,
);
$page = file_get_contents('
https://api.vkontakte.ru/method/photos.save?'.http_build_query($data));
Пишет:
Notice: Trying to get property of non-object in F:\xampp\htdocs\img\up.php on line 24
Notice: Trying to get property of non-object in F:\xampp\htdocs\img\up.php on line 25
Notice: Trying to get property of non-object in F:\xampp\htdocs\img\up.php on line 26
Notice: Trying to get property of non-object in F:\xampp\htdocs\img\up.php on line 27
Notice: Trying to get property of non-object in F:\xampp\htdocs\img\up.php on line 28
Notice: Trying to get property of non-object in F:\xampp\htdocs\img\up.php on line 29
Что не так?