【问题标题】:Submitting comments with PHP (cURL)使用 PHP (cURL) 提交评论
【发布时间】:2021-12-10 23:31:09
【问题描述】:
<?php 
$mycurl = curl_init();
curl_setopt_array($mycurl, 
    [
        CURLOPT_URL => "https://example.com", 
        CURLOPT_RETURNTRANSFER => TRUE, 
        CURLOPT_TIMEOUT => 4, 
        CURLOPT_FOLLOWLOCATION => TRUE, 
        CURLOPT_POST => TRUE, 
        CURLOPT_POSTFIELDS => ["Name" => "Example", "Email" => "Example@gmail.com", "Comment" => "Example"]
    ]
);
$result = curl_exec($mycurl);
curl_close($mycurl); ?>

我知道我的代码错了,我只想学习 PHP。 如何修复我的代码? 我想要非常简单的东西。 我只是想用我发送的信息在网站上发表评论。

【问题讨论】:

  • 什么不起作用,您需要修复什么?
  • 如果您尝试在不属于您自己的网站上发表评论,他们很可能有某种保护措施来阻止您这样做。我建议像其他用户一样使用该表单。

标签: php web curl


【解决方案1】:

https://example.org 不支持 cmets。也许尝试卷曲一个实际上支持 cmets 的服务,例如 Discord

【讨论】:

  • 我知道这只是一个例子:)
猜你喜欢
  • 2013-06-20
  • 1970-01-01
  • 1970-01-01
  • 2011-11-09
  • 2019-01-09
  • 2011-08-11
  • 1970-01-01
  • 2014-04-05
  • 2014-03-20
相关资源
最近更新 更多