Softaculous


Topic : cURL


Posted By: timduongdi123123 on March 13, 2024, 2:08 pm
Hi, i'm newbie. I want to ask if amppstack supports curl, especially the code below.
$params = [
        'code' => $_GET['code'],
        'client_id' => $google_oauth_client_id,
        'client_secret' => $google_oauth_client_secret,
        'redirect_uri' => $google_oauth_redirect_uri,
        'grant_type' => 'authorization_code'
    ];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https(:/)/accounts(.)google(.)com/o/oauth2/token');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response, true);

i want to create login function with google. It runs fine on XAMPP but not AMPPS. $response returns a NULL value.
sorry for my English not good. Tks for support.

Posted By: Brijesh on March 15, 2024, 12:12 pm | Post: 1
Hi,

Yes AMPPS does support curl extension.

You can try adding :
echo curl_error($ch);

before curl_close() and check the output for any errors.

-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool

Powered By AEF 1.0.8 © 2007-2008 Electron Inc.