curl给出403错误? [英] curl gives 403 error?

查看:1212
本文介绍了curl给出403错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从MediaWiki登录页面为我的phpBB论坛设置一个cookie。在登录到wiki后使用钩子是成功的,我想运行一个设置cookie的php脚本。

I'm trying to set a cookie for my phpBB forums from a MediaWiki login page. Using the hook after a login to the wiki is successful, I want to run a php script that sets the cookie.

脚本在我独立运行或使用GET时运行,但为了安全起见,我想对脚本执行POST。对于这个我认为 curl 将是最好的选择。

The script works when I run it independently or when I use GET , but for security reasons I want to POST to the script. For this I figured curl would be the best option.

不幸的是, p>

Unfortunately, even the basic script like this:

curl_setopt($ch, CURLOPT_URL, "http://www.example.com/ForumLogin.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);

给我一​​个403 Forbidden错误。 robots.txt中没有应该干涉的规则。我还可以尝试让脚本工作,还是有其他方法可以从MediaWiki中运行脚本?

Gives me a 403 Forbidden error. There's no rules in robots.txt that should interfere. What else could I try to get the script to work, or are there any other ways I could run the script from within MediaWiki?

推荐答案

p>我怀疑这个理由是明确地停止自动行为 - 反机器人或一般安全措施。您可能希望查看目标站点的源代码,并检查任何此类措施 - 快速搜索403的代码可能提供一些见解。甚至可能是POST请求在这种情况下是不合法的,并且因此出于安全原因而被阻止。

I'd suspect the justification for this is explicitly to stop automated behaviour - an anti-bot or general security measure. You may wish to look at the source code of the destination site and check for any such measures - a quick search of the code for '403' might offer some insight. It may even be the case that POST requests are not legitimate in that context - and thus prevented for security reasons.

我不确定'原因的方式。 POST不比GET更安全。他们都同样受到仔细审查。

I'm not sure what you mean by 'for security reasons' by the way. POST isn't more secure than GET. They're both open to just as much scrutiny.

这篇关于curl给出403错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆