本文整理汇总了PHP中WhatsProt::sendSetProfilePicture方法的典型用法代码示例。如果您正苦于以下问题:PHP WhatsProt::sendSetProfilePicture方法的具体用法?PHP WhatsProt::sendSetProfilePicture怎么用?PHP WhatsProt::sendSetProfilePicture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WhatsProt
的用法示例。
在下文中一共展示了WhatsProt::sendSetProfilePicture方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fwrite
if ($fp) {
fwrite($fp, $data);
fclose($fp);
}
}
//Create the whatsapp object and setup a connection.
$w = new WhatsProt($username, $identity, $nickname, $debug);
$w->connect();
// Now loginWithPassword function sends Nickname and (Available) Presence
$w->loginWithPassword($password);
//Retrieve large profile picture. Output is in /src/php/pictures/ (you need to bind a function
//to the event onProfilePicture so the script knows what to do.
$w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture");
$w->sendGetProfilePicture($target, true);
//update your profile picture
$w->sendSetProfilePicture("demo/venom.jpg");
//send picture
$w->sendMessageImage($target, "demo/x3.jpg");
//send video
//$w->sendMessageVideo($target, 'http://techslides.com/demos/sample-videos/small.mp4');
//send Audio
//$w->sendMessageAudio($target, 'http://www.kozco.com/tech/piano2.wav');
//send Location
//$w->sendLocation($target, '4.948568', '52.352957');
// Implemented out queue messages and auto msgid
$w->sendMessage($target, "Sent from WhatsApi at " . time());
/**
* You can create a ProcessNode class (or whatever name you want) that has a process($node) function
* and pass it through setNewMessageBind, that way everytime the class receives a text message it will run
* the process function to it.
*/
示例2: WhatsProt
//Create the whatsapp object and setup a connection.
$w = new WhatsProt($username, $nickname, $debug);
$w->connect();
// Now loginWithPassword function sends Nickname and (Available) Presence
$w->loginWithPassword($password);
//Retrieve large profile picture. Output is in /src/php/pictures/ (you need to bind a function
//to the event onProfilePicture so the script knows what to do.
$w->eventManager()->bind('onGetProfilePicture', 'onGetProfilePicture');
$w->sendGetProfilePicture($target, true);
//Print when the user goes online/offline (you need to bind a function to the event onPressence
//so the script knows what to do)
$w->eventManager()->bind('onPresenceAvailable', 'onPresenceAvailable');
$w->eventManager()->bind('onPresenceUnavailable', 'onPresenceUnavailable');
echo "[*] Connected to WhatsApp\n\n";
//update your profile picture
$w->sendSetProfilePicture('demo/venom.jpg');
//send picture
$w->sendMessageImage($target, 'demo/x3.jpg');
//send video
//$w->sendMessageVideo($target, 'http://techslides.com/demos/sample-videos/small.mp4');
//send Audio
//$w->sendMessageAudio($target, 'http://www.kozco.com/tech/piano2.wav');
//send Location
//$w->sendMessageLocation($target, '4.948568', '52.352957');
// Implemented out queue messages and auto msgid
$w->sendMessage($target, 'Guess the number :)');
$w->sendMessage($target, 'Sent from WhatsApi at ' . date('H:i'));
while ($w->pollMessage()) {
}
/*
* You can create a ProcessNode class (or whatever name you want) that has a process($node) function
示例3: WhatsProt
$username = $argv[1];
$password = $argv[2];
$nickname = $argv[3];
$identity = $argv[4];
$method = $argv[5];
$args = $argv[6];
$targets = $argv[7];
echo "Username: " . $username . "\r\n";
echo "Password: " . $password . "\r\n";
echo "Nickname: " . $nickname . "\r\n";
echo "Identity: " . $identity . "\r\n";
echo "Method: " . $method . "\r\n";
echo "Args: " . $args . "\r\n";
$w = new WhatsProt($username, $identity, $nickname, true);
$w->connect();
$w->loginWithPassword($password);
if ($method == "sendStatusUpdate") {
echo "About to send status update.\r\n";
$w->sendStatusUpdate($args);
} elseif ($method == "sendProfilePicture") {
echo "About to send profile picture.\r\n";
$w->sendSetProfilePicture($args);
} elseif ($method == "broadcastMessage") {
$targets = explode(",", $targets);
echo "About to broadcast a message.\r\n" . print_r($targets) . "\r\n";
$w->sendBroadcastMessage($targets, $args);
} elseif ($method == "sendBroadcastImage") {
$targets = explode(",", $targets);
$w->sendBroadcastImage($targets, $args, false);
}
sleep(5);
示例4: WhatsProt
<?php
require_once '../whatsprot.class.php';
$username = "436646473355";
//Mobile Phone prefixed with country code so for india it will be 91xxxxxxxx
$password = "Z10t1ePNG1CsjZy5hrnHgXm/v1g=";
$w = new WhatsProt($username, 0, "ADarkHero Whatsapp Bot", true);
//Name your application by replacing "WhatsApp Messaging"
$w->connect();
$w->loginWithPassword($password);
$w->sendSetProfilePicture("profilePic.jpg");
示例5: trim
$w->sendStatusUpdate($status);
break;
case '/profile':
echo "\nEnter your profile picture URL > ";
$profile = trim(fgets(STDIN));
do {
echo "\nIs it right yes/no > ";
$check = trim(fgets(STDIN));
if ($check != 'yes') {
echo "\nEnter your profile picture URL > ";
$profile = trim(fgets(STDIN));
}
} while ($check != 'yes');
if (!filter_var($profile, FILTER_VALIDATE_URL) === false) {
if (@getimagesize($profile) !== false) {
$w->sendSetProfilePicture($profile);
}
} else {
echo "{$profile} is NOT a valid URL\n\n";
}
break;
case '/credits':
echo "\nSpecials thanks to 0xtryCatch :D\n";
break;
case '/secret':
echo "If you are a spammer or bulk sender, this is your lucky day! Follow the link:\n";
echo "http://bit.ly/1dOj8e0\n\n";
echo ":)\n\n";
exit;
break;
case '/newgroup':
示例6: WhatsProt
#!/usr/bin/php -q
<?php
require_once 'lib/whatsApi/whatsprot.class.php';
require_once "user_config.php";
$debug = false;
$w = new WhatsProt($username, $nickname, $debug);
$w->connect();
// Connect to WhatsApp network
$w->loginWithPassword($password);
// logging in with the password we got!
$w->sendSetProfilePicture("/var/tmp/youit_logo.jpg");