Update facebook status with curl

Started on the old forum in September 2010 · view the original in the archive · old links redirect here

11 replies · 4,429 views · started 16 years ago · 1 min read

TL;DR · summary of 11 replies
  • Reply by i_love_php_mysql suggested checking safe mode and enabling curl.
  • xcoderx provided an alternative method using PHP code, login form, and Facebook's share URL.
  • Wyvern advised against this method due to potential account bans.
  • timetraveller1992 offered a client-side solution using wget or sockets for POST requests.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

10 participants
i_love_php_mysql Junior · 34 posts #1

update ur facebook status without logging into facebook.

$username = "@yahoo.com";
$password = "pass";

 
  // do login to facebook
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, "https://login.facebook.com/login.php?m&next=http://m.facebook.com/home.php");
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($curl, CURLOPT_POSTFIELDS, "email=" . $username . "&pass=" . $password . "&login=Log In");
  curl_setopt($curl, CURLOPT_ENCODING, "");
  curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_facebook.cookie');
  $curlData = curl_exec($curl);
  curl_close($curl);
 
  // do get post url
  $urlPost = substr($curlData, strpos($curlData, "action=\"/a/home") + 8);
  $urlPost = substr($urlPost, 0, strpos($urlPost, "\""));
  $urlPost = "http://m.facebook.com" . $urlPost;
 
  // do get some parameters for updating the status
  $fbDtsg = substr($curlData, strpos($curlData, "name=\"fb_dtsg\""));
  $fbDtsg = substr($fbDtsg, strpos($fbDtsg, "value=") + 7);
  $fbDtsg = substr($fbDtsg, 0, strpos($fbDtsg, "\""));
 
  $postFormId = substr($curlData, strpos($curlData, "name=\"post_form_id\""));
  $postFormId = substr($postFormId, strpos($postFormId, "value=") + 7);
  $postFormId = substr($postFormId, 0, strpos($postFormId, "\""));
 
  // do update facebook status
  $statusMessage = "ok i just updated my facebook status without logging into my account :-)";
 
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $urlPost);
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, "fb_dtsg=" . $fbDtsg . "&post_form_id=" . $postFormId . "&status=" . $statusMessage . "&update=Update Status");
  curl_setopt($curl, CURLOPT_ENCODING, "");
  curl_setopt($curl, CURLOPT_COOKIEFILE, getcwd() . '/cookies_facebook.cookie');
  curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_facebook.cookie');
  $curlData = curl_exec($curl);
  curl_close($curl);
 
  echo "Your Facebook status already updated with '" . $statusMessage . "'";

if anyone mods it share here.

shakil420 Developer · 125 posts #2

Curl method n0t working.is it work in freehost? Show error!

i_love_php_mysql Junior · 34 posts #3

do not know free host, but make sure your safe mode is off and curl is enabled.

Mysterio Lead · 630 posts #4

i_love_php_mysql wrote: do not know free host, but make sure your safe mode is off and curl is enabled.

Thanks for your script. I value there is some PHP code we should know how to use.

p.s.: Facebook will ban account after using this method 🙁

mysterio.al - programming is a functional art

xcoderx Junior · 43 posts #6

al u must to do is add php tags nd and also could make a form to login and status msg it field 🙂 i hve used it for sometime. my account stil not banned. but yes better to use their api than to be using this method.

Wyvern Newbie · 6 posts #8

lol nice idea but facebook will now ban those accounts who are using services somthing like this one, why dont just login to your facebook account and update all you want, its so easy isnt it? rather than using this stuffs

  1. Sharing and helping others will enhance your abilities and capabilities.. For me experience and curiuosity is the best teacher.. 🥳 Join http://friendstag.net !!
kei_ki7 Senior · 431 posts #9

I used this before, the problem here is the facebook security always asking because my server is not in my couuntry.

Did I help you? You can help me too Your donations will help me finance my studies.

i_love_php_mysql Junior · 34 posts #10

i hear facebook will ban accunts but my account never banned. and why not login? because i use it on my site to show users update on facebook i sure cannot login copy paste my users update manually all the time 🙂

timetraveller1992 Newbie · 1 posts #11

Facebook will not ban such users. Infact, u can achieve the same using wget in client side program. If u know C with some sockets u can make a similar POST method to achieve this. Make sure u include browser id string else FB might generate a unsupported browser page instead..!

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close