php - 使用 php 发送 whatsapp 消息

标签 php android html whatsapp

你好。 我想使用 php 发送 whatsapp 消息。我运行这段代码

<?php
require_once 'Chat-API-master/src/whatsprot.class.php';
$username = "6285648145xxx";
$nickname = "ardi";
$password = "password"; // The one we got registering the number
$debug = true;

// Create a instance of WhastPort.
$w = new WhatsProt($username, $nickname, $debug);

$w->connect(); // Connect to WhatsApp network
$w->loginWithPassword($password); // logging in with the password we got!

$target = '62811304xxxx'; // The number of the person you are sending the message
$message = 'Hi! :) this is a test message';

$w->sendMessage($target , $message);
?>

但我在浏览器中得到了这段代码

tx  <stream:features></stream:features>

tx  <auth user="6285648145xxx" mechanism="WAUTH-2"></auth>

rx  <from s.whatsapp.net=""></from>

rx  <stream:features></stream:features>

rx  <challenge>376a507c7e915642d85255fe96cb1d101fa23819</challenge>

tx  <response>200e09fa50b7c6a3fa3416878f1e165e8d7670f054ddeaa1c77278a5f8e5b881f4f9f75dce809f42cbdcf17931db8c15641399488b90e9cb74e87de94560802f98bb028af9b5967403fb278c28e06c</response>


Fatal error: Maximum execution time of 30 seconds exceeded in D:\XAMPP\htdocs\waonline\Chat-API-master\src\whatsprot.class.php on line 2609

怎么了??请给我解决方案。谢谢

最佳答案

添加

set_time_limit(120);

你的脚本执行时间太长

关于php - 使用 php 发送 whatsapp 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39721694/

相关文章:

php - 如何让我的网站自动缩小到 90%

javascript - 鼠标移出时动态 jQuery 隐藏 div

android - 通知中的字符串未更新

android - 将列表项从搜索对话框返回到调用 Activity

php - 表单验证也适用于 safari 浏览器

javascript - 如何缩小Html元素?

php - 在 Yii2 的 Controller 中同时使用 beforeAction() 和 behavior() 方法

php - PHP中的音频和Zip文件

java - 如何在不同的 Activity 中播放不同的音乐?

jquery - 如何在不取消选中所选选项的情况下禁用选择框?