Skip to content

Instantly share code, notes, and snippets.

@nextendweb-laszlo
Last active June 9, 2020 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nextendweb-laszlo/be144064aee0e4baadec0f718a4fa0d9 to your computer and use it in GitHub Desktop.
Save nextendweb-laszlo/be144064aee0e4baadec0f718a4fa0d9 to your computer and use it in GitHub Desktop.
NSL REST API - POST with cURL
<?php
$url = 'https://example.com/wp-json/nextend-social-login/v1/facebook/get_user';
$access_token = array(
'access_token' => '{"access_token":"EAAKdOKespJMBAKKanbl7q4vnqvGS6JpJE1IkLIlklxkBtBjIG1u0piAQLby6fwZAj0NGtOSJqY4A6PTfpzWhx77Pci0joIb01RChGO6sMgxShXZBcfnSDBdwTLopyHrtxnCqM7OLvhCCMOaJ2RxFKSAPdqCbhWrZCMxh5w1GIPAZCGxJCKr4jVl43Ig8oCQZD","token_type":"bearer","expires_in":5108158}'
);
$ch = curl_init($url);
$postQuery = http_build_query($access_token);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postQuery);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment