Tuesday 3 July 2012

How to update Random Status Automatically

After a great research on Access tokens, and my Facebook auto liker i am sharing some codes to update random facebook status automatically.

Note: We use access tokens to update status randomly and for auto posting. And you need a hosting with cronjob.

For this, you need to create  2 PHP files and 1 txt file.

Our 1st PHP file will be the main file which accept the access token and contain the posting command.

__________________________________

<?php
$access_token = "Your Access Token";
$url = "https://graph.facebook.com/me/feed?method=POST";
$linx = "http://vivekcreations.com/status.php (Edit the url with your Path of second file Means status.php file)";
$status = file_get_contents($linx);
$ch = curl_init();
$attachment = array( 'access_token' => $access_token,
'message' => $status,
);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
$result= curl_exec($ch);
curl_close ($ch);
?>

____________________________

Save this file as main.php.


Now create second file and save the file with name status.php

______________________________


<?
srand((double)microtime()*1000000);
$Arry_txt= preg_split ("/-vicky-/", join ('', file (" http://vivekcreations.com/status.txt (Edit the url with your Path of second file Means status.txt file) ")));
echo $Arry_txt[rand(0, sizeof($Arry_txt) -1)];
?>

______________________________

Now our last file means txt file which contains all the random status.
Make a txt file and save it with name status.txt

_______________________________


"status 1"
/-vicky-/
"status 2"
/-vicky-/
"Oops"
/-vicky-/
"Status 3"

____________________________

Put your all random status in double qoutes and split them with /-vicky-/ It makes all your status different from each other.

Direct Download all three files in a zip folder from here

Now upload the all files on your server or hosting and simply run main.php file.

How to auto update these random status ?

Well the solution is simple just use cronjob and give a path of your main.php file to execute after every timeslap which you have mentioned in cronjob. like this:


For any question regarding codes just visit the developer profile here ( Vicky Verma )


2 comments:

  1. where is cronjob ?

    ReplyDelete
  2. I am Manju...I have given my photo id...it is taking long time...its still showing process symbol...I want to win a contest n i need some likes...can u please help me..

    ReplyDelete