2
Google 토플 URL에 코드가있어 액세스 토큰으로 변환 할 수 있습니까? 컬을 사용했지만 작동하지 않습니다. 배터와 쉬운 생각 나는 그것을 codeigniter에서 사용해야합니다. 이고 그 authorization_code는 무엇입니까?Google api + php + codeigniter + curl
<?php
$field='code='.$_REQUEST['code'].'&client_id=clirnt-id
&client_secret=client-secret
&redirect_uri=http: // localost/googleapi/curlreq.php
&grant_type=authorization_code';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.googleapis.com/oauth2/v3/token");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$field);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: application/x-www-form-urlencoded'));
$server_output = curl_exec ($ch);
echo 'end';
echo '<br/>';
//echo $server_output;
print_r($server_output);
curl_close ($ch);
?>
https://github.com/google/google-api-php-client –
시도해보십시오. Hybrid Auth가 제공합니다. 그것은 모든 apis yahoo, fb, g +, twitter everthing을 제공합니다 .. 정말 좋았어요. –