Подскажите PHP Compatibility Checker выдает ошибку при переходе на php
подскажите как исправить ?
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
16 | WARNING | Use of deprecated PHP4 style class constructor is not supported since PHP 7.
---------------------------------------------------------------------------------------------
? class vkapi {
var $access_token;
var $api_url;
function vkapi($api_url = 'api.vk.com/method/') {
if (!strstr($api_url, 'https://')) $api_url = 'https://'.$api_url;
$this->api_url = $api_url;
}
function api($method,$params=false) {
if (!$params) $params = array();
$params["v"] = "5.75";
ksort($params);
$sig = '';
foreach($params as $k=>$v) {
$sig .= $k.'='.$v;
}
$query = $this->api_url.$method.'?'.$this->params($params);
if (function_exists('curl_init')) {
$ch = curl_init();
@curl_setopt($ch,CURLOPT_URL,$query);
@curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
@curl_setopt($ch,CURLOPT_TIMEOUT, 2);
//задает время на соединение с сервером
@curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 2);
//я не скрипт, я браузер опера
@curl_setopt($ch, CURLOPT_USERAGENT, 'Opera 10.00');
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
@curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
@curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
$res = @curl_exec($ch);
@curl_close($ch);
// контрольный выстрел в голову
if(empty($res)){
$res = @file_get_contents($query);
}
}else{
$res = @file_get_contents($query);
}
return @json_decode($res, true);
}
function params($params) {
$pice = array();
foreach($params as $k=>$v) {
$pice[] = $k.'='.urlencode($v);
}
return implode('&',$pice);
}
}
-
This reply was modified 3 years, 11 months ago by leon977.
-
This reply was modified 3 years, 11 months ago by leon977.
-
This reply was modified 3 years, 11 months ago by Yui. Reason: please use CODE button for proper formatting