繁体   English   中英

Cloudflare 阻止来自 AWS EC2 (CPANEL) 的 PHP CURL 请求

[英]Cloudflare blocking PHP CURL request from AWS EC2 (CPANEL)

我正在尝试向配置了 cloudflare 的 API 发送请求,我得到了这个结果 -

在此处输入图像描述

I tried all things like CURL, HTTP_Request2, file_get_contents() function but not working, this script is working on other servers/hosting providers and also working through postman but not on my AWS EC2 instance, it is telling me to enable cookies but am not确定该怎么做。 请帮我解决这个问题。

这是我的 CURL 代码 -

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://smmpython.com/api/v2?key=28ccb7d9a72fe96191466bb24a92aeba5c29c297&action=balance',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

这可能是 CloudFare 实施的一项安全措施。 想象一堆调用 CloudFare 的 IP 地址,它可能会触发小型应用程序的 DDoS。 以下是一些建议:

  • 将弹性 IP (EIP) 与您的 EC2 实例连接

  • 如果这不起作用,那么您可以联系 CloudFare 支持以启用来自特定 IP 的流量(白名单)

  • 如果他们对此有任何特定的解决方案,作为附加步骤检查 AWS 支持

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM