Answer the question
In order to leave comments, you need to log in
The script does not parse by api, how to fix it?
<?php
if($_POST["uid"] == "") {
echo '<div class="alert alert-warning"><center><h4>Заполните форму!</h4></center></div>';
}else{
if (isset($_POST['uid'])){
$uid = htmlspecialchars($_POST['uid']);
$groups_getMembers = api("groups.getMembers", "group_id=" . $uid);
$count = $groups_getMembers ["response"] ["count"];
$groups_getById = api("groups.getById", "group_id=" . $uid . "&fields=photo_50,status,verified");
$name = $groups_getById ["response"] ["0"] ["name"];
$screen_name = $groups_getById ["response"] ["0"] ["screen_name"];
$photo_50 = $groups_getById ["response"] ["0"] ["photo_50"];
$status = $groups_getById ["response"] ["0"] ["status"];
$type = $groups_getById ["response"] ["0"] ["type"];
$verified = $groups_getById ["response"] ["0"] ["verified"];
$cs = preg_replace("!http://(.*?)/(.*)!si", "http://\\1", $photo_50);
$vk_com = preg_replace("!http://(.*?)/(.*?)!si", "\\1/\\2", $photo_50);
$pp = preg_replace("!http://(.*?).vk.me/(.*?)!si", "\\1/\\2", $photo_50);
if($cs == "http://vk.com") {
$img = "https://".$vk_com."";
} else {
$img = "https://pp.vk.me/".str_replace(array("cs"), array("c"), $pp)."";
}
if($verified == "1"){
$ver = "Присутствует";
}
else{
$ver = "Отсутствует";
}
if($count){
echo '<div class="alert alert-info">
<img style="float:right;" src="'.$img.'">
'.$name.'<br><br>
Верификация: '.$ver.'<br>
Тип группы: '.$type.'<br>
Статус: '.$status.'<br>
Домен: vk.com/'.$screen_name.'</div>';
}else{
echo '<div class="alert alert-warning"><center><h4>Ошибка</h4></center></div>';
}
}
}
function api($method, $parameter) {
$return = curl("https://api.vk.com/method/" . $method . "?" . $parameter);
return json_decode($return, true);
}
function curl($url, $post = null) {
$ch = curl_init( $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417
Firefox/3.0.3');
if ($post) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
$response = curl_exec( $ch );
curl_close( $ch );
return $response;
}
?>
<?php
if($_POST["uid"] == "") {
echo '<div class="alert alert-warning"><center><h4>Заполните форму!</h4></center></div>';
}else{
if (isset($_POST['uid'])){
$uid = htmlspecialchars($_POST['uid']);
$groups_getMembers = api("groups.getMembers", "group_id=" . $uid);
$count = $groups_getMembers ["response"] ["count"];
$groups_getById = api("groups.getById", "group_id=" . $uid . "&fields=photo_50,status,verified");
$name = $groups_getById ["response"] ["0"] ["name"];
$screen_name = $groups_getById ["response"] ["0"] ["screen_name"];
$photo_50 = $groups_getById ["response"] ["0"] ["photo_50"];
$status = $groups_getById ["response"] ["0"] ["status"];
$type = $groups_getById ["response"] ["0"] ["type"];
$verified = $groups_getById ["response"] ["0"] ["verified"];
$cs = preg_replace("!http://(.*?)/(.*)!si", "http://\\1", $photo_50);
$vk_com = preg_replace("!http://(.*?)/(.*?)!si", "\\1/\\2", $photo_50);
$pp = preg_replace("!http://(.*?).vk.me/(.*?)!si", "\\1/\\2", $photo_50);
if($cs == "http://vk.com") {
$img = "https://".$vk_com."";
} else {
$img = "https://pp.vk.me/".str_replace(array("cs"), array("c"), $pp)."";
}
if($verified == "1"){
$ver = "Присутствует";
}
else{
$ver = "Отсутствует";
}
if($count){
echo '<div class="alert alert-info">
<img style="float:right;" src="'.$img.'">
'.$name.'<br><br>
Верификация: '.$ver.'<br>
Тип группы: '.$type.'<br>
Статус: '.$status.'<br>
Домен: vk.com/'.$screen_name.'</div>';
}else{
echo '<div class="alert alert-warning"><center><h4>Ошибка</h4></center></div>';
}
}
}
function api($method, $parameter) {
$return = curl("https://api.vk.com/method/" . $method . "?" . $parameter);
return json_decode($return, true);
}
function curl($url, $post = null) {
$ch = curl_init( $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417
Firefox/3.0.3');
if ($post) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question