Telegram PHP(Windows 7):无法打开流:HTTP请求失败!找不到HTT
我正试图在Telegram中移动我的第一步,我也是
PHP的新手……
我已经在我的Windows 7 PC上配置了Apache 2.4 with PHP 5.6.14和SSL,它在http和https中运行良好. 然后我试着按照这个Telegram Bot Tutorial https://www.youtube.com/watch?v=hJBYojK7DO4.一切正常,直到我必须创建一个像这样的简单PHP程序 <?php $botToken = "<my_bot_token>"; $website = "https://api.telegram.org/bot".$botToken; $update = file_get_contents($website."/getUpates"); print_r($update); ?> 当我尝试放入浏览器时 https://localhost/Telegram/MyYouTubeTutorialBot/YouTubeTutorialBot.php 反应是 Warning: file_get_contents(https://api.telegram.org/<my_bot_token>/getupates): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in <my_php_file_location> on line 6 我在网上搜索了类似的问题但没有解决:最有趣的回答是在这个问题file_get_contents – failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found但我不明白如何使它适应我的情况. 在其他响应中有建议使用curl,但我想解决持续的file_get_contents函数. 我认为这不是一个PHP问题,而是我的配置中的某些东西……我不知道在哪里 有什么建议? 非常感谢你提前 切萨雷 增加注意事项 我的原始代码中出现了拼写错误,因为@aeryaguzov在评论中提出了…. 在这里你是现在可以使用的固定代码…… <?php $botToken = "<my_bot_token>"; $website = "https://api.telegram.org/bot".$botToken; $update = file_get_contents($website."/getUpdates"); print_r($update); ?> 解决方法
在您的配置中,这不是PHP问题. 该错误表示文件https://api.telegram.org/u0026lt;my_bot_tokenu0026gt;/getupates不存在.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |