Answer the question
In order to leave comments, you need to log in
Why can't I complete the request?
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$token = '';
$wall = file_get_contents("http://api.vk.com/method/wall.get?v=5.7&filter=all&domain=achan&count=1000");
$wall = json_decode($wall);
$wall = $wall->response->items;
for ($i = 0; $i < count($wall); $i++) {
$x = $wall[$i]->post_type;
if($x !== 'post'){
$date1 = new DateTime("now");
$date2 = new DateTime("@".$wall[$i]->date);
$interval = $date2->diff($date1);
$day = $interval->format("%d");
if($day == '1'){
while ($gid = '-100562658')
{
$statusSet = curl('https://api.vk.com/method/wall.delete?v=5.7&owner_id'.$gid.'&access_token='.$token.'&post_id='.$wall[$i]->id);
}
function curl( $url ){
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
$response = curl_exec( $ch );
curl_close( $ch );
return $response;
}
}
}}
?>
Answer the question
In order to leave comments, you need to log in
<?php
$token = '';
$wall = file_get_contents("http://api.vk.com/method/wall.get?v=5.7&filter=all&domain=achan&count=1000");
$postAmount = count($wall->response->items);
$counter = 1;
$currentTime = new DateTime("now");
foreach($wall->response->items as $currentItem)
{
$postDate = new DateTime(date("Y-m-d H:i:s", $currentItem->date));
$interval = $currentTime->diff($postDate);
if($interval->d >= 1)
{
echo $counter.". Нужно удалить\t".$postDate->format("Y-m-d H:i:s")."\n";
}
else
{
echo $counter.". Пока оставляем\t".$postDate->format("Y-m-d H:i:s")."\n";
}
$counter++;
}
?>
The symbol "=" is missing in the link for one of the parameters:&owner_id'.$gid.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question