使用php发送Whatsapp消息
问题描述:
嗨。 我想用php发送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);
你的脚本耗时过长执行
+0
除了一些托管公司将禁用此功能 – RiggsFolly
+0
,其中我把代码'set_time_limit(120);''也许你有使用PHP发送消息的其他代码? – ardi
+0
在出现错误的脚本中有一个php命令 – Marcin
隐藏密码,如果它的正确 – devpro
那么你已经超过了你的配置允许PHP脚本的默认最大运行时间。这是可以修复的,但是我从代码中看不到实际显示为什么30秒没有足够时间运行该脚本。那么这是你的脚本中的所有代码? – RiggsFolly
为什么[tag:android]标签? – RiggsFolly