承接 waaltcom/whatools-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

waaltcom/whatools-php

Composer 安装命令:

composer require waaltcom/whatools-php

包简介

PHP lib for integrating Whatools into your app easily.

README 文档

README

PHP lib for integrating Whatools into your app easily

Notice

This lib works only with v3 API. Please make sure your Whatools line is configured to use such API version.

API reference

Setting up

The only thing you need is including this library and then create an API object by passing your Whatools API key as a parameter to the class constructor.

include("whatools.inc.php");
$w = new Whatools("Put here your API key");

Remember that you can get the API key for your Whatools line by logging into Whatools and then going to Advanced settings > REST API.

Logging in and out

Logging in and out is the analog process in v3 API to subscribing and unsubscribing in older API versions. Nevertheless, in v3, when you log out you are effectively closing the connection between WhatsApp servers and your account, so you can be sure that you never miss a single message.

$w->login();
echo "Logged in as +", $w->whatsappInfo->cc, $w->whatsappInfo->pn, "\n";
$w->logout();

Setting your nickname

$w->nicknamePost("John Doe");

Getting your nickname

$nickname = $w->nicknameGet("John Doe");

Setting your status message

$w->statusPost("To be, or not to be, that is the question.");

Getting your status message

$status = $w->statusGet();

Setting your avatar

$w->avatarPost("Route for an image file");

Getting and storing someone's avatar

$avatar = $w->avatarGet("Phone number in international format");
file_put_contents("avatar.jpg", $avatar);

Sending a message

$w->messagePost("Phone number in international format", "Body of the message");

Sending a picture

$w->picturePost("Phone number in international format", "Route for an image file", "Optional caption");

Retrieving and printing messages received and sent since last logout

$messages = $w->messageGet();
foreach ($messages as $message)
{
  if ($msg->mine)
    echo "> ", $msg->to;
  else
    echo "< ", $msg->from;
  echo "\n\t\"", $msg->body, "\"";
  echo "\n\t@", $msg->stamp;
  echo "\n\tACK: ", $msg->ack, "\n";
}

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-09-22