1

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

pskkar
  • 432
  • 1
  • 4
  • 18

1 Answers1

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