简体   繁体   中英

PHP - Sending post request through my server

I want to use Google Services such as reCaptcha, and I got a problem on PHP which doesn't work to me when sending https requests to Google.

From what I understood, I needed to enable the cUrl extension and I enabled it in the php.ini. However, the problem wasn't solved.

I'll be glad if anyone can guide me through the process of sending a https request through PHP

$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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM