Auto Post On Blogspot Using PHP script

Auto Post On Blogspot Using PHP script

Auto Post On Blogspot Using PHP script

Today, We want to share with you Auto Post On Blogspot Using PHP script.
In this post we will show you Automatically Post Content To Blogspot Using PHP, hear for Automatically post to a Blogspot page using the Blogspot PHP API we will give you demo and example for implement.
In this post, we will learn about Automatically Post Content To Blogspot Using PHP with an example.

How to Auto Post on Blogspot with PHP Example

This Offical document Learn how to get step by step How to Auto Post on Blogspot with PHP started using the Blogger API.Blogger API

Read Also:  Google Responsive Charts (Pie Bar Column) Examples

//Dynemic generate return URL
$redirct_url = "https://".$_SERVER["HTTP_HOST"].$_SERVER['PHP_SELF'];
//include all libs using google
require_once 'google-api-php-client-master/src/Google/autoload.php'; 

$google_clnt = new Google_Client();

$google_clnt->setScopes(array('')); //since we are going to use blogger services

$bloggerService = new Google_Service_Blogger($google_clnt);

if (isset($_GET['logout'])) { // Google logout: Your destroy token
 die('Good Luck Logged out.');

if (isset($_GET['code'])) { // we get the positive google auth callback, get the simple google auth token and some store it in session
	$_SESSION['token'] = $google_clnt->getAccessToken();

if (isset($_SESSION['token'])) { // extract get token from session and configure google_clnt
	$get_token = $_SESSION['token'];

if (!$google_clnt->getAccessToken()) { // Your auth call to google
	$authUrl = $google_clnt->createAuthUrl();
	header("Location: ".$authUrl);

$posts = $bloggerService->posts;

$LivePost = new Google_Service_Blogger_Post();
$LivePost->setTitle("WRITE_YOUR_POST_TITLE ".time());
$LivePost->setCustomMetaData("YOUR_CUSTOM_META_DATA ".time());

	$nposts = $posts->insert("4842995321113595808",$LivePost);
catch(Exception $e)
	//generate Error

Auto Post to Blogger with Title , post label and search some description using Blogger PHP Script API v 3.0

Read Also:  Top 10 Ways to Increase Google Adsense Earnings

And then this post, After that We logged into blogger on Google Product. I can display the above post title and description there. With this auto post has successfully upload ‘Post Title’ as well as ‘Post Body’.

Adding a post : Auto Post On Blogspot Using PHP

We can Simple Add an Auto post for a google product blog by sending a POST All the data request to the using post Methods collection URL with a post Simple JSON body:

Auto Post On Blogspot Using PHP : Request

Authorization: /* get here Google OAuth 2.0 token here */
Content-Type: application/json

  "kind": "blogger#post",
  "blog": {
    "id": "4842995321113595808"
  "title": "My First Auto Post On Blogspot Using PHP Example ",
  "content": "Welcome <h2></h2> You Are Always Welcome..."

We must be Google authenticated to Add a Auto post on The Google Blogger.

Read Also:  Enable Google Shopping Actions Steps

We hope you get an idea about Auto post into Blogspot using php Source code
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

Your email address will not be published. Required fields are marked *