的值
详细信息如下:首先我会点击这个链接,例如http://your.app/callback?code=abc123然后我将从代码中接收值来自url的变量,然后我想将此url重定向为中的POST操作https://api.another.com/tokengrant_type=authorization_code&code=[code]url,带有code
使用卷曲:
一个例子:
<?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);
?>