Bulletproof
Bulletproof

Reputation: 51

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

Upvotes: 2

Views: 101

Answers (1)

David Demetradze
David Demetradze

Reputation: 1371

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

Upvotes: 1

Related Questions