【发布时间】:2019-08-17 01:15:10
【问题描述】:
我正在创建一个 Wordpress 插件,它会在一些交易后创建一个会议,但我不知道如何获取令牌。我做了一些测试,但似乎没有用。
尝试做一些post CURL。
$consumerKey = "consumer_key_here";
$url = "https://api.getgo.com/oauth/v2/authorize?client_id={$consumerKey}&response_type=code";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.107 Chrome/32.0.1700.107 Safari/537.36');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
$test = curl_exec($ch);
if (curl_error($ch)) {
echo curl_error($ch);
}
print $test;
这应该被重定向到所需的重定向 url,并带有参数响应代码。
【问题讨论】: