api - Can't get Youtube access token with curl (PHP) -
i'm following this guide make server side youtube web app in php. can't past step 4. good, redirects script , can obtain authorization code no problem. however, when try exchange code authorization token (as demonstrated in step 4), absolutely nothing happens. can't find errors, nothing happens on browser. php script (private info removed):
<?php $data = array( 'code' => $_get['code'], 'client_id' => '[removed]', 'client_secret' => '[removed]', 'redirect_uri' => '[removed]', 'grant_type' => 'authorization_code'); $ch = curl_init(); curl_setopt($ch, curlopt_url, 'https://accounts.google.com/o/oauth2/token'); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $data); curl_setopt($ch, curlopt_returntransfer, true); $return = curl_exec($ch); curl_close($ch); echo $return; ?>
maybe i'm way on head here, can tell me why it's not working?
try adding,
curl_setopt($ch, curlopt_ssl_verifypeer, false);
after curlopt_returntransfer
Comments
Post a Comment