为什么会引发错误,我该如何纠正?如何交谈?

一年多以来,我一直在我的产品中对我的网站进行 CURL,以跟踪安装情况。最近我恢复了我的 GoDaddy 服务器,但我不再能够 CURL 进入我的域。

这是我一年多来的 CURL:

$url = 'http://dirtrif.com/installs.php';
$fields['username'] = $vbulletin->userinfo[username];
$fields['userid'] = $vbulletin->userinfo[userid];
$fields['email'] = $vbulletin->userinfo[email];
$fields['addontitle'] = $info['title'];
$fields['productid'] = $info['productid'];
$fields['addonversion'] = $info['version'];
$fields['bburl'] = $vbulletin->options[bburl];
$fields['bbtitle'] = $vbulletin->options[bbtitle];
$fields['webmasteremail'] = $vbulletin->options[webmasteremail];
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$result = curl_exec($ch);
curl_close($ch); 

在恢复我的服务器之前,我通过在我的服务器上安装的 GoDaddy 获得了 SSL 证书,这种方法运行良好。

自从恢复我的服务器后,我已为我的证书切换到 ZeroSSL。我能想到的唯一其他问题是我的 .htaccess,其中包含:

RewriteEngine On 
# remove www from host
RewriteCond %{HTTP_HOST} ^www.(.+)
RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

我有 2 个产品安装跟踪器,一个位于 vbteam.net/installs.php,另一个位于 dirtrif.com/installs.php,它们是相同的,并且使用上面的 curl,只需更改域,一个可以工作,另一个不能工作。唯一的区别是一个站点是 SSL,一个不是。

我已与 GoDaddy 支持人员进行了交谈,他们引用了我 this article 仍然无济于事。在与代表交谈时。我在我的 PHPINFO 中注意到了这一行:_SERVER[“HTTP_UPGRADE_INSECURE_REQUESTS”] 1 并认为这可能是问题所在,但据我所知,我无法将其关闭。

我尝试过很多事情,来回切换域 vbteam 总是发布数据,而 dirtrif 没有。我已经包含了一个用户代理,尝试了 DW 文章中提到的代理,将我的 URL 从 http 切换到 https 没有任何东西可以让我在 80% 的尝试中将我的数据发布到 dirtrif导致 403 错误

我一直在使用其他堆栈问题中使用的其他方法的变体在我的本地主机上进行测试,但无济于事。以下只是我一直在尝试的一个示例。

$url = 'http://dirtrif.com/installs.php';
$fields['username'] = 'Bodfsadfbs';
$fields['userid'] = '342';
$fields['email'] = 'bo34bs';
$fields['addontitle'] = 'bob43s';
$fields['productid'] = 'bo34344bs';
$fields['addonversion'] = '43442';
$fields['bburl'] = 'bo343bs';
$fields['bbtitle'] = 'b34obs';
$fields['webmasteremail'] = '34bobs';
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();
$userAgent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)';
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$result = curl_exec($ch);
curl_close($ch); 

只需将网址从dirtrif.com 更改为vbteam.net 即可,我需要使用dirtrif 版本。

为什么会引发 403 错误,我该如何纠正?

© 版权声明
THE END
喜欢就支持一下吧
点赞178赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容