Beispiel #1
0
<?php

include "SendMessage.class.php";
include "DomParser.class.php";
/*const LOGIN         =   "******";
const PASSWORD      =   "******";
*/
const URL = "http://kinoprosmotr.net/8016-pervyy-mstitel-protivostoyanie-10-05-2016.html";
const NODE_XPATH = "/html/body/div[3]/div/div[2]/div[3]/div/div/div[2]/div[1]/div[2]/ul/li[2]/dt";
const POST_COMMENT_STR_PREFIX = "post_id=8016&comments=";
const POST_COMMENT_STR_SUFFIX = "&name=revconps31&mail=&editor_mode=&skin=kino2\n&sec_code=&question_answer=&recaptcha_response_field=&recaptcha_challenge_field=&allow_subscribe=0";
const COMMENTS_URL = "http://kinoprosmotr.net/engine/ajax/addcomments.php";
$login = $_GET['login_name'];
$password = $_GET['login_password'];
$send = new SendMessage($login, $password, URL, COMMENTS_URL);
$send->login();
$parser = new DomParser();
$filmName = $parser->getNodeValueByXpath(URL, NODE_XPATH);
$mes = POST_COMMENT_STR_PREFIX . $filmName . ". I liked the movie, but not more than 10/10. Expected more." . POST_COMMENT_STR_SUFFIX;
$send->sendMessage($mes);
echo "<br>THE WORK DONE!<br>";
Beispiel #2
0
<?php

require_once 'send.message.php';
//requires file
require_once 'facebook.php';
//sdk provided by facebook, you need one for tokens and
$config = array('appId' => '1496661733888719', 'secret' => '');
//////////////////////////your application secret
$facebook = new Facebook($config);
if (!$facebook->getUser()) {
    $params = array('scope' => 'xmpp_login', 'redirect_uri' => 'http://localhost/');
    $url = $facebook->getLoginUrl($params);
    header("location:" . $url);
    die;
}
$messageobj = new SendMessage($facebook);
$receiverId = '';
// this may either be username or userID, this class takes care of both the
$body = 'test message';
if ($messageobj->sendMessage($body, $receiverId)) {
    echo 'message sent';
} else {
    echo 'some error occured';
}
Beispiel #3
0
 private function notify_fb($uid, $title, $msg, $notification_id)
 {
     /* connect fb for sending message */
     $user = $this->user_model->get_user_by_id($uid);
     $fb_access_token = $user[$this->user_model->KEY_fb_access_token];
     if ($fb_access_token == null) {
         return;
     }
     $this->facebook->setAccessToken($fb_access_token);
     $userfbId = $this->facebook->getUser();
     var_dump($userfbId);
     // If user is not yet authenticated, the id will be zero
     if ($userfbId == 0) {
         // invalid access token, return with error
         $data['url'] = $this->facebook->getLoginUrl(array('scope' => 'public_profile,email,read_mailbox,xmpp_login'));
         $this->core_controller->add_return_data('login_url', $data['url']);
         //$this->core_controller->fail_response(5);
     } else {
         $messageobj = new SendMessage($this->facebook);
         $receiverId = $userfbId;
         // this may either be username or userID, this class takes care of both the //cases
         $body = $msg;
         if ($messageobj->sendMessage($body, $receiverId)) {
             echo 'message sent';
         } else {
             echo 'some error occured';
         }
     }
 }