Скрипт php для сбора записей с пометкой реклама в сообществе

В редакторе

Скрипт php для сбора записей с пометкой реклама в сообществе

Brain_Script
1245
2018-10-28 17:53:29
<?php $cur_unix = time(); $time_max = $cur_unix - 31556926; $guid = ""; $ofset = 0; $admintoken = ""; if (!file_exists("baza.txt")) { do { $getwallother = vkapi('wall.get?owner_id=-'.$guid.'&offset='.$ofset.'&count=100&filter=owner&access_token='.$admintoken.'&v=5.68'); usleep(360000); $decode_getwallother = json_decode($getwallother,true); $getwallother_count = $decode_getwallother['response'][count]; $getwallother_items = $decode_getwallother['response']['items']; foreach ($getwallother_items as $item) { $post_id = $item['id']; $isad = $item['marked_as_ads']; $owner = $item['copy_history']['0']['owner_id']; $times = $item['date']; var_dump ($isad); echo " "; if ($isad == 1) { $baza[$post_id] = $owner; } } $ofset = $ofset + 100; ++$try; if (is_null($post_id)) { break; } if ($try > 500) { break; } } while ($times > $time_max); ssnwrite($baza, "baza.txt"); } if (file_exists("baza.txt")) { $baza = ssread("baza.txt"); echo ' <table cellpadding="1" cellspacing="0" border="1">'; echo "<tr><td>Рекламный пост</td><td>Откуда сделан репост</td></tr>"; foreach ($baza as $key_b => $value_b) { $ist = preg_replace('/-/', '', $value_b); echo '<tr><td><a href="https://vk.com/wall-'.$guid.'_'.$key_b.'" >https://vk.com/wall-'.$guid.'_'.$key_b.'</a> </td>'; echo '<td>https://vk.com/club'.$ist.'</td></tr>'; } echo "</tbody></table> "; } // functions //***************** READY FOR WORK API FUNCTION function vkapi($method, $proxy_ip, $proxy_userpwd, $proxy_type) { $ch = curl_init("https://api.vk.com/method/".$method); curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_TIMEOUT, 10); if((strlen($proxy_ip) > 4 and strlen($proxy_userpwd) > 4) or $proxy_type == 55) { curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curl_setopt($ch, CURLOPT_PROXY, $proxy_ip); curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_userpwd); } if((strlen($proxy_ip) > 4 and strlen($proxy_userpwd) < 4 and is_null($proxy_type)) or $proxy_type == 1) { curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt($ch, CURLOPT_PROXY, $proxy_ip); } if($proxy_type == 2) { curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS); curl_setopt($ch, CURLOPT_PROXY, $proxy_ip); } if($proxy_type == 4) { curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); curl_setopt($ch, CURLOPT_PROXY, $proxy_ip); } if($proxy_type == 5) { curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curl_setopt($ch, CURLOPT_PROXY, $proxy_ip); } $response = curl_exec($ch); curl_close($ch); return $response; } function ssread($rte) {$rfile = fopen("$rte", "r"); $gfile = fgets($rfile, 88411488); fclose($rfile); $funs = unserialize($gfile); ksort($funs); return $funs; } function ssnwrite($ssa, $rte) { $ss = serialize($ssa); $writer = fopen("$rte", "w+b"); fwrite($writer,$ss); fclose($writer); } ?>
Войдите для добавления комментария.
Нет комментариев
Яндекс.Метрика Яндекс.Метрика