Larevel HTTP客户端错误403生产
我正在研究一个致电电子商务网站以获取一些信息并对其进行分析的项目。
我编写了以下代码以获取信息:
use Illuminate\Support\Facades\Http;
class TheController extends Controller {
public function getProductAndCompetitors() {
public function getInformation() {
$url = 'https://www.noon.com/_svc/catalog/api/v3/search?sku=N29905443A';
$response = HTTP::get($url);
dd($response);
}
}
问题:
该代码在Localhost上工作,但是将其部署到服务器时返回403错误。
附加信息:
- 外部网站基于KSA(不知道服务器在哪里),
- 当我将URL复制并粘贴到浏览器中时,它返回200
- 中在我们的共享托管服务器上工作
- 该代码在我们 代码正在ksa中的localhost工作。
- 代码在VPS服务器上不起作用是Frankfort
我尝试使用guzzlehttp \ client并添加一些标题,但这也不起作用
I'm working on a project that calls an e-commerce website to get some information and does analysis on them.
I wrote the following code to get the information:
use Illuminate\Support\Facades\Http;
class TheController extends Controller {
public function getProductAndCompetitors() {
public function getInformation() {
$url = 'https://www.noon.com/_svc/catalog/api/v3/search?sku=N29905443A';
$response = HTTP::get($url);
dd($response);
}
}
The problem:
the code is working on localhost but returning 403 error when I deployed it to a server.
Additional information:
- the external website is based in KSA (no idea where the server is)
- when I copy and paste the url in the browser it returns 200
- the code is working on a shared hosting server in US
- the code is working on localhost in KSA
- the code is not working on VPS server is Frankfort
I tried to use GuzzleHttp\Client instead and add some headers but this didn't work as well
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于声誉较低,我无法发表评论,但是我需要查看日志。检查您的服务器,让我知道它在说什么。
这可能从多种原因范围内,我遇到了“丢失密钥”的问题(
php工匠密钥:生成
)I cannot comment due to low reputation, but I need to see the logs. Check your server and let me know what it says.
This could range from a variety of reasons, and I have encountered to be common the issue of the "missing key" (
php artisan key:generate
)也许有关他们可能不喜欢从服务器作为卷发发送的问题,它们允许在Local主机上,但有时会根据服务器的请求将其阻止。
maybe issue regarding they might not like request being send from server as curl, they allow it on localhost but they sometimes block it on requests from a server.