Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this fixed facebook plugin. It worked for me! (You have to use the latest openinviter version)</p> <pre><code>&lt;?php /*Import Friends from Facebook * You can send message to your Friends Inbox */ $_pluginInfo=array( 'name'=&gt;'Facebook', 'version'=&gt;'1.3.0', 'description'=&gt;"Get the contacts from a Facebook account", 'base_version'=&gt;'1.8.4', 'type'=&gt;'social', 'check_url'=&gt;'http://apps.facebook.com/causes/', 'requirement'=&gt;'email', 'allowed_domains'=&gt;false, ); /** * FaceBook Plugin * * Imports user's contacts from FaceBook and sends * messages using FaceBook's internal system. * * @author OpenInviter * @version 1.0.8 */ class facebook extends openinviter_base { private $login_ok=false; public $showContacts=true; public $internalError=false; protected $timeout=30; protected $userId; public $debug_array=array( 'initial_get'=&gt;'pass', 'login_post'=&gt;'javascript', 'get_user_id'=&gt;'profile.php?id=', 'url_friends'=&gt;'fb_dtsg:"', 'message_elements'=&gt;'fb_dtsg', 'send_message'=&gt;'"__ar":1', ); /** * Login function * * Makes all the necessary requests to authenticate * the current user to the server. * * @param string $user The current user. * @param string $pass The password for the current user. * @return bool TRUE if the current user was authenticated successfully, FALSE otherwise. */ public function login($user,$pass) { $this-&gt;resetDebugger(); $this-&gt;service='facebook'; $this-&gt;service_user=$user; $this-&gt;service_password=$pass; if (!$this-&gt;init()) return false; $res=$this-&gt;get("http://apps.facebook.com/causes/",true); if ($this-&gt;checkResponse("initial_get",$res)) $this-&gt;updateDebugBuffer('initial_get',"http://apps.facebook.com/causes/",'GET'); else{ $this-&gt;updateDebugBuffer('initial_get',"http://apps.facebook.com/causes/",'GET',false); $this-&gt;debugRequest(); $this-&gt;stopPlugin(); return false; } $form_action="https://login.facebook.com/login.php?login_attempt=1"; $post_elements=array('email'=&gt;$user, 'pass'=&gt;$pass, 'next'=&gt;'http://apps.facebook.com/causes/home?_method=GET', 'return_session'=&gt;0, 'req_perms'=&gt;0, 'session_key_only'=&gt;0, 'api_key'=&gt;$this-&gt;getElementString($res,'name="api_key" value="','"'), 'version'=&gt;'1.0', ); $res=$this-&gt;post($form_action,$post_elements,true,true); if ($this-&gt;checkResponse("login_post",$res)) $this-&gt;updateDebugBuffer('login_post',"{$form_action}",'POST',true,$post_elements); else{ $this-&gt;updateDebugBuffer('login_post',"{$form_action}",'POST',false,$post_elements); $this-&gt;debugRequest(); $this-&gt;stopPlugin(); return false; } $res=$this-&gt;get('http://facebook.com/',true); if ($this-&gt;checkResponse("get_user_id",$res)) $this-&gt;updateDebugBuffer('get_user_id',"http://facebook.com/",'GET'); else{ $this-&gt;updateDebugBuffer('get_user_id',"http://facebook.com/",'GET',false); $this-&gt;debugRequest(); $this-&gt;stopPlugin(); return false; } //$this-&gt;userId=$this-&gt;getElementString($res,"{user:",','); fixed by vikastyagi87@gmail.com $this-&gt;userId=$this-&gt;getElementString($res,"user:",','); if (empty($this-&gt;userId)) $this-&gt;login_ok=false; else $this-&gt;login_ok="http://www.facebook.com/ajax/social_graph/fetch.php?__a=1"; return true; } /** * Get the current user's contacts * * Makes all the necesarry requests to import * the current user's contacts * * @return mixed The array if contacts if importing was successful, FALSE otherwise. */ public function getMyContacts() { if (!$this-&gt;login_ok) { $this-&gt;debugRequest(); $this-&gt;stopPlugin(); return false; } else $url=$this-&gt;login_ok; $res=$this-&gt;get("http://www.facebook.com/profile.php?id={$this-&gt;userId}",true); if (strpos($res,'window.location.replace("')!==FALSE) { $url_redirect=stripslashes($this-&gt;getElementString($res,'window.location.replace("','"')); if (!empty($url_redirect)) $res=$this-&gt;get($url_redirect,true); } if ($this-&gt;checkResponse("url_friends",$res)) $this-&gt;updateDebugBuffer('url_friends',"http://www.facebook.com/profile.php?id={$this-&gt;userId}&amp;ref=profile",'GET'); else{ $this-&gt;updateDebugBuffer('url_friends',"http://www.facebook.com/profile.php?id={$this-&gt;userId}&amp;ref=profile",'GET',false); $this-&gt;debugRequest(); $this-&gt;stopPlugin(); return false; } $postFormId=$this-&gt;getElementString($res,'name="post_form_id" value="','"'); $fbDtsg=$this-&gt;getElementString($res,'fb_dtsg:"','"'); $page=0; $form_action=$this-&gt;login_ok; $post_elements=array('edge_type'=&gt;'browse', 'page'=&gt;$page, 'limit'=&gt;100, 'node_id'=&gt;$this-&gt;userId, 'class'=&gt;'FriendManager', 'post_form_id'=&gt;$postFormId, 'fb_dtsg'=&gt;$fbDtsg, 'post_form_id_source'=&gt;'AsyncReques', ); $res=$this-&gt;post($form_action,$post_elements,true); $contacts=array(); while(preg_match_all("#\{\"id\"\:(.+)\,\"title\"\:\"(.+)\"#U",$res,$matches)) { $page++; $post_elements=array('edge_type'=&gt;'browse', 'page'=&gt;$page, 'limit'=&gt;100, 'node_id'=&gt;$this-&gt;userId, 'class'=&gt;'FriendManager', 'post_form_id'=&gt;$postFormId, 'fb_dtsg'=&gt;$fbDtsg, 'post_form_id_source'=&gt;'AsyncReques', ); $res=$this-&gt;post($form_action,$post_elements); if (!empty($matches[1])) foreach($matches[1] as $key=&gt;$fbId) if (!empty($matches[2][$key])) $contacts[$fbId]=$matches[2][$key]; } return $contacts; } /** * Send message to contacts * * Sends a message to the contacts using * the service's inernal messaging system * * @param string $session_id The OpenInviter user's session ID * @param string $message The message being sent to your contacts * @param array $contacts An array of the contacts that will receive the message * @return mixed FALSE on failure. */ /*public function sendMessage($session_id,$message,$contacts) { $res=$this-&gt;get('http://www.facebook.com/?sk=messages',true); if ($this-&gt;checkResponse("message_elements",$res)) $this-&gt;updateDebugBuffer('message_elements',"http://www.facebook.com/home.php?#!/?sk=messages",'GET'); else{ $this-&gt;updateDebugBuffer('message_elements',"http://www.facebook.com/home.php?#!/?sk=messages",'GET',false); $this-&gt;debugRequest(); $this-&gt;stopPlugin(); return false; } $postFormId=$this-&gt;getElementString($res,'name="post_form_id" value="','"'); $fbDtsg=$this-&gt;getElementString($res,'fb_dtsg:"','"'); $form_action="http://www.facebook.com/ajax/messaging/async.php?__a=1"; $post_elements=array(); $countMessages=0; foreach($contacts as $fbId=&gt;$name) { $countMessages++; if ($countMessages&gt;$this-&gt;maxMessages) break; $post_elements=array( 'forward_msg'=&gt;'', 'body'=&gt;$message['body'], 'action'=&gt;'send', 'recipients[0]'=&gt;$fbId, 'force_sms'=&gt;false, 'post_form_id'=&gt;$postFormId, 'fb_dtsg'=&gt;$fbDtsg, 'post_form_id_source'=&gt;'AsyncRequest' ); $res=$this-&gt;post($form_action,$post_elements); if ($this-&gt;checkResponse("send_message",$res)) $this-&gt;updateDebugBuffer('send_message',"{$form_action}",'POST',true,$post_elements); else{ $this-&gt;updateDebugBuffer('send_message',"{$form_action}",'POST',false,$post_elements); $this-&gt;debugRequest(); $this-&gt;stopPlugin(); return false; } sleep($this-&gt;messageDelay); if ($countMessages&gt;$this-&gt;maxMessages) { $this-&gt;debugRequest();$this-&gt;resetDebugger();$this-&gt;stopPlugin();break; } } }*/ public function sendMessage($session_id, $message, $contacts) { $res = $this-&gt;get('http://www.facebook.com/?sk=messages&amp;fb_noscript=1', true); $res = $this-&gt;get('http://www.facebook.com/?sk=inbox', true); if ($this-&gt;checkResponse("message_elements", $res)) $this-&gt;updateDebugBuffer('message_elements', "http://www.facebook.com/home.php?#!/?sk=messages", 'GET'); else { $this-&gt;updateDebugBuffer('message_elements', "http://www.facebook.com/home.php?#!/?sk=messages", 'GET', false); $this-&gt;debugRequest(); $this-&gt;stopPlugin(); return false; } $postFormId = $this-&gt;getElementString($res, 'name="post_form_id" value="', '"'); $fbDtsg = $this-&gt;getElementString($res, 'fb_dtsg:"', '"'); $form_action = "http://www.facebook.com/ajax/messaging/async.php?__a=1"; $form_action_gigaboxx = "http://www.facebook.com/ajax/gigaboxx/endpoint/MessageComposerEndpoint.php?__a=1"; $post_elements = array(); $post_elements_gigaboxx = array(); $countMessages = 0; foreach ($contacts as $fbId =&gt; $name) { $countMessages++; if ($countMessages &gt; $this-&gt;maxMessages) break; $post_elements = array('forward_msg' =&gt; '', 'body' =&gt; $message['body'], 'action' =&gt; 'send', 'recipients[0]' =&gt; $fbId, 'force_sms' =&gt; false, 'post_form_id' =&gt; $postFormId, 'fb_dtsg' =&gt; $fbDtsg, 'post_form_id_source' =&gt; 'AsyncRequest' ); $post_elements_gigaboxx = array('_log_action' =&gt; 'send_new', 'subject' =&gt; $message['subject'], 'status' =&gt; $message['body'], 'action' =&gt; 'send_new', 'ids[0]' =&gt; $fbId, 'post_form_id' =&gt; $postFormId, 'fb_dtsg' =&gt; $fbDtsg, 'post_form_id_source' =&gt; 'AsyncRequest', 'target_id' =&gt; '0' ); $res = $this-&gt;post($form_action, $post_elements); if ($this-&gt;checkResponse("send_message", $res)) $this-&gt;updateDebugBuffer('send_message', "{$form_action}", 'POST', true, $post_elements); else { $res = $this-&gt;post($form_action_gigaboxx, $post_elements_gigaboxx); if ($this-&gt;checkResponse("send_message", $res)) { $this-&gt;updateDebugBuffer('send_message', "{$form_action_gigaboxx}", 'POST', true, $post_elements_gigaboxx); } else { $this-&gt;updateDebugBuffer('send_message', "{$form_action}", 'POST', false, $post_elements); $this-&gt;debugRequest(); $this-&gt;stopPlugin(); return false; } sleep($this-&gt;messageDelay); if ($countMessages &gt; $this-&gt;maxMessages) { $this-&gt;debugRequest(); $this-&gt;resetDebugger(); $this-&gt;stopPlugin(); break; } } } } /** * Terminate session * * Terminates the current user's session, * debugs the request and reset's the internal * debudder. * * @return bool TRUE if the session was terminated successfully, FALSE otherwise. */ public function logout() { if (!$this-&gt;checkSession()) return false; $res=$this-&gt;get("http://www.facebook.com/home.php",true); if (!empty($res)) $res=$this-&gt;get('http://www.facebook.com/logout.php?h='.html_entity_decode($this-&gt;getElementString($res,'http://www.facebook.com/logout.php?h=','"'))); $this-&gt;debugRequest(); $this-&gt;resetDebugger(); $this-&gt;stopPlugin(); return true; } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload