php - Invalid Credentials error when trying to add post to blogger using API -


i have trying add post blogger using api since yesterday no luck. here code. when run it, "invalid credentials" error.

i have posted screenshot below shows getting key in google developer console. may picking wrong key?

code

<?php $key  = "j7c"; $blog_id = "123456";  $url = 'https://www.googleapis.com/blogger/v3/blogs/'.$blog_id.'/posts/'; $postdata = array(     'kind' => 'blogger#post',     'blog' => array('id' => $blog_id),     'title' => 'this title',     'content' => 'this content' );  $data_string = json_encode($postdata);  $head = array(); $head[] = 'authorization: '.$key; $head[] = 'content-type: application/json';  $ch = curl_init(); curl_setopt($ch, curlopt_httpheader, $head); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_postfields, $data_string); curl_setopt($ch, curlopt_ssl_verifypeer, 1); curl_setopt($ch, curlopt_ssl_verifyhost, 2); $rsp = curl_exec($ch); $results = json_decode($rsp); var_dump($rsp); ?> 

error
enter image description here

google developer console
enter image description here


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -