本文整理汇总了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) {
示例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>
示例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();