Answer the question
In order to leave comments, you need to log in
file_get_contents doesn't work. What am I doing wrong?
I'm dumb and don't understand what I'm doing wrong.
enlighten the idiot.
spoiler: I have a server = vds, where everything is set up correctly in php. and file_get_contents work with curl. and the link itself is absolutely correct, how much I checked.
function replyWI($chat,$text,$numbuttons,$buttonsarr = []){
$arr = '{"buttons":,"inline":true}';
$arr = json_encode($arr, JSON_UNESCAPED_UNICODE);
$random_id = random_int(1,9999999);
$link = 'https://api.vk.com/method/execute?access_token=123123&v=5.103&code=return%20API.messages.send({"random_id":'. $random_id .',"peer_id":'. $chat .',"message":"'. $text .'","group_id":123123123"keyboard": '. $arr .'});';
return json_decode(file_get_contents($link),true);
}
replyWI($peer_id,"Текстик.",2,[1 => "ван", 2 => "ту"]);
Answer the question
In order to leave comments, you need to log in
At one time, get content didn’t work for me either, I couldn’t understand what the problem was at point-blank range. It turned out that the problem was not in the script, but in the fact that the end site was blocking all requests from suspicious user agents. In short, setting the correct header helped me, disguised the user agent as chrome and it all worked.
Try it yourself:
https://yandex.ru/search/touch/?text=file_get_cont...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question