當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WhatsProt::sendGetProfilePicture方法代碼示例

本文整理匯總了PHP中WhatsProt::sendGetProfilePicture方法的典型用法代碼示例。如果您正苦於以下問題:PHP WhatsProt::sendGetProfilePicture方法的具體用法?PHP WhatsProt::sendGetProfilePicture怎麽用?PHP WhatsProt::sendGetProfilePicture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WhatsProt的用法示例。


在下文中一共展示了WhatsProt::sendGetProfilePicture方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: WhatsProt

    $_SESSION["inbound"] = $in;
    session_write_close();
}
require_once '../whatsprot.class.php';
$target = @$_POST["target"];
$username = "************";
$password = "******************************";
$w = new WhatsProt($username, 0, "WhatsApi AJAX Demo", true);
$w->eventManager()->bind("onGetImage", "onGetImage");
$w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture");
$w->connect();
$w->loginWithPassword($password);
$initial = @$_POST["initial"];
if ($initial == "true" && $target != null) {
    //request contact picture only on first call
    $w->sendGetProfilePicture($target);
}
//subscribe contact status
$w->SendPresenceSubscription($target);
//TODO: presense handling (online/offline/typing/last seen)
while (running($time)) {
    $w->pollMessages();
    running($time);
    //check again if timestamp has been updated
    //check for outbound messages to send:
    session_start();
    $outbound = $_SESSION["outbound"];
    $_SESSION["outbound"] = array();
    session_write_close();
    if (count($outbound) > 0) {
        foreach ($outbound as $message) {
開發者ID:nekulin,項目名稱:WhatsAPI,代碼行數:31,代碼來源:socket.php

示例2: onGetProfilePicture

//This function only needed to show how eventmanager works.
function onGetProfilePicture($from, $target, $type, $data)
{
    if ($type == "preview") {
        $filename = "preview_" . $target . ".jpg";
    } else {
        $filename = $target . ".jpg";
    }
    $filename = WhatsProt::PICTURES_FOLDER . "/" . $filename;
    $fp = @fopen($filename, "w");
    if ($fp) {
        fwrite($fp, $data);
        fclose($fp);
    }
    echo '<a href="' . $filename . '"><center><img src="' . $filename . '" height="250" width="250"></center></a><br><br>';
    echo '<center><b>Pulsa en la imagen para verlo a tamaño completo</b></center>';
}
$w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture");
$w->sendGetProfilePicture($target, true);
?>
 <ul>
                          <li>
                          </li>
                        </ul>
                      <div>
                      </div>
                    </div>
                  </li>
                </ol>
</html>
開發者ID:aristofanio,項目名稱:WhatsApp-Tools,代碼行數:30,代碼來源:perfil.php

示例3: time

    $time = time();
    $filename = $pictureof . "_@_" . $time . ".jpg";
    $filename = WhatsProt::PICTURES_FOLDER . "/" . $filename;
    $fp = @fopen($filename, "w");
    if ($fp) {
        fwrite($fp, $data);
        fclose($fp);
        $user = new User();
        $user->connectDB();
        if (empty($filename)) {
            $filename = 'pictures/unknown.jpg';
        }
        try {
            $user->newUser($_POST['user_id'], $_POST['phone'], $_POST['username'], $filename);
            header("Location:index.php");
        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }
}
$identity = strtolower(urlencode(sha1($username, true)));
$w = new WhatsProt($username, $identity, $username, false);
$w->Connect();
$w->LoginWithPassword($password);
try {
    $w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture");
    $w->sendGetProfilePicture($phone);
} catch (Exception $e) {
    echo $e->getMessage();
}
$w->disconnect();
開發者ID:abazad,項目名稱:whatsappGUI,代碼行數:31,代碼來源:newcontact.php


注:本文中的WhatsProt::sendGetProfilePicture方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。