[英]What should I do when I get error "HTTP 403 from proxy after CONNECT" using cURL in PHP?
I'd like to see my messages using Telegram API, like "/getupdates or "/getme", and I read I have to user cURL, but unfortunately I don't see anything on the page... blank page. So what's wrong whit my code blow here?我想使用 Telegram API 来查看我的消息,例如“/getupdates 或“/getme”,我读到我必须使用 cURL,但不幸的是我在页面上看不到任何内容......空白页。那是什么我的代码错了吗?
<?php
$botToken = "172894271:****myTelegramBotId****";
$botUrl = "https://api.telegram.org/bot" . $botToken;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $botUrl."/geupdates");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
//url error: Received HTTP code 403 from proxy after CONNECT
if(curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch);}
echo $result;
?>
The error is: "url error: Received HTTP code 403 from proxy after CONNECT"错误是:“url 错误:CONNECT 后从代理收到 HTTP 代码 403”
You should get a number of warnings if the error reporting is enabled.如果启用了错误报告,您应该会收到许多警告。
For example, this one:例如,这个:
Warning: curl_setopt() expects exactly 3 parameters, 2 given in ..\index.php on line X
for this line specifically:专门针对这一行:
<?php
error_reporting(E_ALL);
ini_set("display_errors",1);
...
curl_setopt($ch, CURLOPT_RETURNTRANSFER);
In addition, where $handle
comes from?另外,
$handle
是从哪里来的? it should be $ch
, no?它应该是
$ch
,不是吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.