开发者

oauth_signature generation for Google API

开发者 https://www.devze.com 2023-03-30 17:43 出处:网络
I am trying to get the contacts of user for my website, but I am not able to get a token from google because i am getting invalid oauth signature error. Can anyone tell me how to generate an oauth sig

I am trying to get the contacts of user for my website, but I am not able to get a token from google because i am getting invalid oauth signature error. Can anyone tell me how to generate an oauth signature in PHP f开发者_运维知识库or google.

Thanks :)


this is how I did for getting data from google analytics

  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, 'https://www.google.com/accounts/ClientLogin');
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($curl, CURLOPT_POST, TRUE);
  $data = array(
    'accountType' => 'GOOGLE',
    'Email' => $email, //your google email
    'Passwd' => $password, //your google pass
    'service' => 'analytics',
    'source' => 'curl-accountFeed-v2'
    );
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
  $response = curl_exec($curl);
  $info = curl_getinfo($curl);
  curl_close($curl);
  if ($info['http_code'] == 200) {
   if ($response) {
     preg_match('/Auth=(.*)/', $response, $matches);
     if (isset($matches[1])) {
       $auth_code = $matches[1];
     }
   }
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号