Tagged: Auto Post on Facebook with PHP script

Auto Post On LinkedIn Using PHP script 0

Auto Post On LinkedIn Using PHP script

Auto Post On LinkedIn Using PHP script

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

LinkedIn Get Access Token using PHP

You can Best Way to get the LinkedIn Access Token by follow the Step By Step of This Link Get Access Tokens – LinkedIn Login – LinkedIn for Developers in serialized form.

get user access token for linkedin 4

get user access token for linkedin 4

Auto Post on LinkedIn using PHP Script

First of all for the Simple Example of the LinkedIn Auto Post script make a PHP file autopost.php and then Copy Past the following below Source code:

//include here OAuth.php File
require_once("OAuth.php");
 
$config = array(
    'consumer_key' => '{YOUR_LIVE_CLIENT_ID}',
    'consumer_secret' => '{YOUR_KEY_OF_THE_CLIENT_SECRET}',
    'callback_url' => ''
);
 
$req_mthd = new OAuthSignatureMethod_HMAC_SHA1();
$live_consume = new OAuthConsumer($config['consumer_key'], $config['consumer_secret']);
 
$access_token = unserialize($access_token); 

<a href="<a class="vglnk" href="https://pakainfo.com/jobs/technology/php-linkedin-authentication-accesstoken-linkedin-oauth-2-0/" rel="nofollow"><span>http</span><span>://</span><span>www</span><span>.</span><span>pakaInfo</span><span>.</span><span>com</span><span>/</span><span>2020</span><span>/</span><span>09</span><span>/</span><span>get</span><span>-</span><span>user</span><span>-</span><span>access</span><span>-</span><span>token</span><span>-</span><span>for</span><span>-</span><span>linkedin</span></a>" target="_blank"><strong>get user Access Token for LinkedIn</strong></a>
 
$title = "Auto Post On Blogspot Using PHP script";
$YourtargetURI = "<a class="vglnk" href="https://pakainfo.com/jobs/technology/google/auto-post-blogspot-using-php-script/" rel="nofollow"><span>http</span><span>://</span><span>www</span><span>.</span><span>pakaInfo</span><span>.</span><span>com</span><span>/</span><span>2020</span><span>/</span><span>09</span><span>/</span><span>auto</span><span>-</span><span>post</span><span>-</span><span>on</span><span>-</span><span>linkedin</span><span>-</span><span>using</span><span>-</span><span>php</span><span>-</span><span>oauth</span></a>";
$imgUrl = "<a class="vglnk" href="https://pakainfo.com/wp-content/uploads/2018/01/get-user-access-token-for-linkedin-4.png" rel="nofollow"><span>http</span><span>://</span><span>www</span><span>.</span><span>pakaInfo</span><span>.</span><span>com</span><span>/</span><span>wp</span><span>-</span><span>content</span><span>/</span><span>uploads</span><span>/</span><span>2020</span><span>/</span><span>09</span><span>/</span><span>Auto</span><span>-</span><span>Post</span><span>-</span><span>on</span><span>-</span><span>LinkedIn</span><span>-</span><span>Using</span><span>-</span><span>PHP</span><span>-</span><span>OAuth</span><span>.</span><span>png</span></a>";
$description= "PakaInfo was founded in January 2018. We deliver Jobs, Earn Money, Education, Health, Technology, Life Style, Science, Top10 and Nature.";
 
$live_pakainfo_url = "<a class="vglnk" href="http://api.linkedin.com/v1/people/~/shares" rel="nofollow"><span>http</span><span>://</span><span>api</span><span>.</span><span>linkedin</span><span>.</span><span>com</span><span>/</span><span>v1</span><span>/</span><span>people</span><span>/~/</span><span>shares</span></a>";
$xml = "<share>";
$xml .= "<content>
<title>$title</title>
<description>$description</description>";
if(!empty($YourtargetURI)){
    $xml .= "<submitted-url>$YourtargetURI</submitted-url>";
}
 
if(!empty($imgUrl)){
    $xml .= "<submitted-image-url>$imgUrl</submitted-image-url>";
}
$xml .= "</content>
  <visibility>
    <code>anyone</code>
  </visibility>
</share>";
 
$live_req = OAuthRequest::from_consumer_and_token($live_consume, $access_token, "POST", $live_pakainfo_url);
$live_req->sign_request($req_mthd, $live_consume, $access_token);
$linkdin_auth_head = $live_req->to_header("<a class="vglnk" href="https://api.linkedin.com" rel="nofollow"><span>https</span><span>://</span><span>api</span><span>.</span><span>linkedin</span><span>.</span><span>com</span></a>");
 
$response = httpRequest($live_pakainfo_url, $linkdin_auth_head, "POST", $xml);
 
function httpRequest($url, $linkdin_auth_head, $req_mthd, $body = NULL) {
    if (!$req_mthd) {
        $req_mthd = "GET";
    }
 
    $live_ch = curl_init();
    curl_setopt($live_ch, CURLOPT_URL, $url);
    curl_setopt($live_ch, CURLOPT_HEADER, 0);
    curl_setopt($live_ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($live_ch, CURLOPT_HTTPHEADER, array($linkdin_auth_head)); // Set the all Your LinkedIn headers.
 
    if ($body) {
        curl_setopt($live_ch, CURLOPT_POST, 1);
        curl_setopt($live_ch, CURLOPT_POSTFIELDS, $body);
        curl_setopt($live_ch, CURLOPT_CUSTOMREQUEST, $req_mthd);
        curl_setopt($live_ch, CURLOPT_HTTPHEADER, array($linkdin_auth_head, "Content-Type: text/xml;charset=utf-8"));  
    }
 
    $resData = curl_exec($live_ch);
    curl_getinfo($live_ch, CURLINFO_HTTP_CODE);
    curl_close($live_ch);
    return $resData;
}

You can Display this in your All the LinkedIn activities. Here is the Latest My LinkedIn screen of the Share Data or Logo content shared on the Live Users using LinkedIn account.

Auto Post On LinkedIn Using PHP script

Auto Post On LinkedIn Using PHP script

We hope you get an idea about Auto post into LinkedIn 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!.

Auto Post on Facebook Page using Facebook PHP API 0

Auto Post on Facebook Page using Facebook PHP API

Auto Post on Facebook Page using Facebook PHP API

Today, We want to share with you Auto Post on Facebook Page using Facebook PHP API.
In this post we will show you How to Auto Post on Facebook Using PHP, hear for Automatically Post Content To Facebook Using PHP we will give you demo and example for implement.
In this post, we will learn about Automatically post to a Facebook page using the Facebook PHP API (v5) with an example.

Step 1: Create a Facebook ‘App’ on Facebook Developers:

First Of all step We need to create a Latest a Facebook App, which is required in order to use the API. Login to your Facebook Developers account and Simple click the ‘Add a New App’ link as shown below Screen Shot:

Automatically post to a Facebook page using the Facebook PHP API 1

Automatically post to a Facebook page using the Facebook PHP API 1

Simple your App name and click to tap ‘create’. Under section Like as ‘settings’, We Will need to Simple Add a or selected‘website platform’ and enter the your domain name like as a (http://live24u.com/) where this script will take. For security, it’s also worth adding the IP address of the server where your site takes in the Simple ‘Server IP Whitelist’ Input field. We do so under The Options Like as ‘advanced settings’.

Automatically post to a Facebook page using the Facebook PHP API 2

Automatically post to a Facebook page using the Facebook PHP API 2

Step 2: Facebook PHP SDK Install :

In this example I Will Suppose your Source code will take in a Simple ‘facebook’ Directory in the root directory of your Website. First of All, make a blank in root Path ‘index.php’ file within your ‘facebook’ Directory. And then, We need to require the Facebook SDK for PHP.

Facebook approve We require the PHP SDK in your project using Download Composer, but We can also manually do so. In this example I will manually Put require the Facebook SDK, Therefor We First of All need to Simple All the Script Package download the Facebook SDK.

Unzip the Facebook Package files and put the Simple Path the ‘src’ Directory in your ‘facebook’ Directory. Then include the Facebook SDK File in your Root index.php file Below Example:

//Include Facebook SDK Libs
define('FACEBOOK_SDK_V4_SRC_DIR', __DIR__.'/src/Facebook/');

//require autoload.php File
require_once(__DIR__.'/src/Facebook/autoload.php');

Step 3 : settings your Facebook App’s:

After that, We need to Setting your Facebook ‘App ID’ and Facebook ‘App secret’ keys into the source code below.step By step Get this code We can get your Facebook App’s ‘App ID’ and ‘App secret’ under the Main Home Facebook ‘dashboard’ tab Sections:

$fb = new Facebook\Facebook([
 'app_id' => 'YOUR_APP_ID',
 'app_secret' => 'YOUR_SECRET_KEY',
 'default_graph_version' => 'v2.2',
]);

Step 4. Get Facebook Access Token for your Facebook App:

And then, if We want to Facebook Auto post Link and Data content to your Facebook Wall page like I needed to… We are gonna to need to get step By step a Facebook non-expiring Access Token for your Facebook page. And then Fisrt Of All the, Open Facebook Graph API Explorer and get Token. Here We Will Display an Simple Facebook ‘Application’ press button in the Facebook Developers Account’s top right cornrs as See below:

Automatically post to a Facebook page using the Facebook PHP API 3

Automatically post to a Facebook page using the Facebook PHP API 3

As We can Display, Just this is set to Facebook ‘Graph API Explorer’. Select your Facebook App instead. Now click the ‘get token’ button which We can also Display in the image above. Select First of all the ‘Get User Access Token’ As well as make simple sure the options select ‘publish_pages’ and ‘manage_pages’ granted permissions are ticked, then click the ‘Get Access Token’ button. Now click the ‘get token’ button again and select your Facebook page. We Just have your get Facebook Access Token which we need to Step By step convert into the Facebook non-expiring uniq Pass the Access Token. To do Therefor, pass param your Facebook App ID, Facebook App Secret Key as well as Facebook Access Token Put into the following Below URL:

//Get Access Token using this url
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=

//pass param
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=YOUR_APP_ID&client_secret=CLIENT_SECRET_KEY_CODE&fb_exchange_token=FACEBOOK_TOKEN

After that All the copy Simple the token here provided.

Step 5. post Content to a Facebook page Script:

after that, the source code that actually posts the content to the Facebook page. In Simple Script Intigrated PHP Code We wanted to Randomly loop using WordPress Images, posts, Content and post a link and Any More comment for any newly added the Simple posts onto my clients Facebook Wall page. Within my WordPress Randomly posts loop was the all important Source code below:

//Post All the Data property to Facebook
$linkData = [
 'link' => 'www.live24u.com',
 'message' => 'YOUR_MSG_DATA_CONTENT_HERE'
];
$getTokenAccess ='PAST_YOUR_ACCESS_TOKEN_HERE';

try {
 $response = $fb->post('/me/feed', $linkData, $getTokenAccess);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
 echo 'Graph returned an error: '.$e->getMessage();
 exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
 echo 'Facebook SDK returned an error: '.$e->getMessage();
 exit;
}
$graphNode = $response->getGraphNode();

There We go, if We now execute this file it will post your All the content to your Facebook wall page.

IMP Note: We Shall Display the post Link, Images appear on the Facebook Wall page, but no-one any else will as We have not set your Facebook Devloper web App Like as a ‘live’! Mode To do Therefor, Simple go back to your Facebook own Developers account and then select your devloper App. And next step to the Under the simple ‘Status & Review’select tab checked the checkbox at the top of the facebook page next to the text Like as a ‘Do We want to Create facebook app and all its live features here available to the all the data general public?’.

6. The automation on Facebook:

Last step all We needed was the simple Script Facebook automation. To simple this all We needed to do was set up a Your Webserver cron job that ran the Simple index.php file every any 5 hours or more amount of hours… as well as there was the Automatically post to a Facebook.

We hope you get an idea about Auto Post on Facebook with PHP script
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!.

Auto Post On Blogspot Using PHP script 0

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

//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->setApplicationName("PakaInfo");
$google_clnt->setDeveloperKey("Ahdjhjdfid554dDDDkjkjkk52-25sdjs20dddKsjhdd5");

$google_clnt->setAccessType('online');
$google_clnt->setClientId("988995555356-9898kasjdjdibmi55ss1bk94plhu58Dioene.apps.googleusercontent.com");
$google_clnt->setClientSecret("82cVvhOy5z3hsW2Ur4fgdfg8QXaBR");
$google_clnt->setRedirectUri($redirct_url);
$google_clnt->setScopes(array('https://www.googleapis.com/auth/blogger')); //since we are going to use blogger services

$bloggerService = new Google_Service_Blogger($google_clnt);

if (isset($_GET['logout'])) { // Google logout: Your destroy token
unset($_SESSION['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
	$google_clnt->authenticate($_GET['code']);
	$_SESSION['token'] = $google_clnt->getAccessToken();
}

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

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

$posts = $bloggerService->posts;

$LivePost = new Google_Service_Blogger_Post();
$LivePost->setTitle("WRITE_YOUR_POST_TITLE ".time());
$LivePost->setLabels("WRITE_YOUR_POST_LABEL");
$LivePost->setContent("WRITE_YOUR_POST_CONTENT!!!!");
$LivePost->setCustomMetaData("YOUR_CUSTOM_META_DATA ".time());

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

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

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:

https://www.googleapis.com/blogger/v3/blogs/blogId/posts/

Auto Post On Blogspot Using PHP : Request

POST https://www.googleapis.com/blogger/v3/blogs/4842995321113595808/posts/
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>pakainfo.com</h2> You Are Always Welcome..."
}

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

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!.