Details are here: First i will hit on this link eg. http://your.app/callback?code=abc123 then i will receive value from code variable from url then i want to redirect this url as a POST action in https://api.another.com/token grant_type=authorization_code& code=[CODE] url, bearing the value of code
Asked
Active
Viewed 51 times
1
-
you can use curl or file_get_contents – Pardeep Poria Apr 29 '16 at 05:37
1 Answers
0
Use Curl:
An example:
<?php
// if you get the code here from the url,
$code = $_GET['code'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://api.another.com/");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"token_grant_type=authorization_code&code=" + $code);
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
?>

Agam
- 1,109
- 9
- 10