@AdaSchwartz

В чём ошибка (file_get_contents)?

Выдаёт ошибку:" file_get_contents(): Unable to get input stream for connection"
$token=$this->edit->text; 
$id=$this->textArea->text; 
STR_replace('http://vk.com/', '', $id); 
$this->textArea->text=$id; 
$this->textArea3->text.='Очистили список ссылок от: "http://vk.com/"'; 
STR_replace('public', '', $id); 
$this->textArea3->text.='Очистили список ссылок от: "public"'; 
STR_replace('club', '', $id); 
$this->textArea->text=$id; 
$this->textArea3->text.='Очистили список ссылок от: "club"'; 
$array = json_decode($h,true); 
$links = array($this->textArea->text); 
foreach ( $links as $links ) { 
$h = file_get_contents("https://api.vk.com/method=utils.resolveScreenName&screen_name=$links&acces_token=$token&v=5.62"); 
$array = json_decode($h,true); 
$p.=$array['response']['object_id'];
  • Вопрос задан
  • 248 просмотров
Пригласить эксперта
Ответы на вопрос 2
Stalker_RED
@Stalker_RED
Попробуйте запустить такой код
$w = stream_get_wrappers();
echo 'openssl: ',  extension_loaded  ('openssl') ? 'yes':'no', "\n";
echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "\n";
echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "\n";
echo 'wrappers: ', var_export($w);

На выходе должно быть что-то вроде этого:
openssl: yes
http wrapper: yes
https wrapper: yes
wrappers: array(11) {
  [...]
}
Так вы узнаете чего именно ему не хватает для обработки этого запроса.

© https://stackoverflow.com/a/1975949
Ответ написан
userfordownload
@userfordownload
тут неверно :
$h = file_get_contents("https://api.vk.com/method=utils.resolveScreenName&...");

надо
$request_params = array(
           'screen_name'=> $links,
           'access_token' => $token
        );
$get_params = http_build_query($request_params);
$h = json_decode(file_get_contents('https://api.vk.com/method/utils.resolveScreenName?' . $get_params ));

ошибка в знаке "="
m/method=utils.resolv

а надо
m/method?utils.resolv
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы