你好。
我想使用 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
怎么了??请给我解决方案。谢谢
使用官方“点击聊天”API
第一种可能的方法是通过 URL 过程将用户发送至:
https://api.whatsapp.com/send?phone=XXYYYYYYYY
(where XX
是国家/地区代码并且YYYYYYYY
是数字)
如今,API 的格式更短,并且允许包含文本消息。
https://wa.me/XXYYYYYYYY/?text=urlencodedtext
(where URL-encodedtext
是 URL 编码的预填充消息)
也可以只分配一条要发送的消息,但不指定用户,让用户稍后选择将其发送给谁,从而能够使用以下方法一次将其发送给许多人:
https://wa.me/?text=urlencodedtext
您可以在这里查看所有官方当前信息https://faq.whatsapp.com/en/android/26000030/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)