【问题标题】:PHP - Sending post request through my serverPHP - 通过我的服务器发送帖子请求
【发布时间】:2016-03-29 22:01:56
【问题描述】:

我想使用诸如 reCaptcha 之类的 Google 服务,但在向 Google 发送 https 请求时我遇到了 PHP 问题。

据我了解,我需要启用 cUrl 扩展,并在 php.ini 中启用它。然而问题并没有解决。

如果有人能指导我完成通过 PHP 发送 https 请求的过程,我会很高兴

【问题讨论】:

  • 启用 curl 后是否重启了 XAMPP/WAMP/LAMP 服务器
  • no.. 我对这个主题很陌生
  • 重启你的服务器
  • 好吧...我不知道如何启动服务器... ;-;

标签: php curl https


【解决方案1】:
$url = 'url.php';

$fields = ['Code' => "1", 'Sequence' => "1"];

$postvars = http_build_query($fields);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
$result = curl_exec($ch);
curl_close($ch);

【讨论】:

  • 致命错误:在第 20 行的 (path)/recaptcha_verifier.php 中调用未定义函数 curl_init()
  • @Bulletproof Curl 扩展需要初始化。
  • 我该怎么做?我在 php.ini 启用了它,但它不起作用
  • @Bulletproof 你使用 xampp 吗?
  • @Bulletproof apachefriends.org/index.html 作为初学者,你应该使用它。
猜你喜欢
  • 1970-01-01
  • 2010-10-31
  • 1970-01-01
  • 1970-01-01
  • 2017-10-20
  • 1970-01-01
  • 2013-08-24
  • 1970-01-01
  • 2015-03-02
相关资源
最近更新 更多