【发布时间】:2016-11-11 00:54:19
【问题描述】:
我想创建一个使用 Telegram API 发送图像的函数(参考 API:https://github.com/mgp25/Telegram-Bot-API/),但是当我尝试运行它时,我总是收到如下错误:
消息:file_get_contents(''):打开流失败:HTTP 请求失败! HTTP/1.1 400 错误请求
这是我的代码[更新]:
<?php
require 'Telegram.php';
$tele = new telegramBot('token');
//$info = $tele->sendMessage('218945828',"wadaw");
$url= 'image/maldini.jpg';
$info = $tele->sendPhoto('chatid',$url);
print_r($info);
?>
错误:
警告:file_get_contents(https://api.telegram.org/bot_token/sendPhoto?chat_id=chat_id&photo=0):无法打开流:php_network_getaddresses:getaddrinfo 失败:不知道这样的主机。在 C:\xampp\htdocs\mgp25\Telegram-Bot-API-master\src\Telegram.php 第 465 行
我的代码有什么问题?
【问题讨论】:
标签: php file telegram-bot