我正在尝试发送 USSD 并开始工作,但出现如下错误。 ussd/send(错误111016)和ussd/get(125003)。您能告诉我哪里可能出错吗?
脚本
#!/bin/sh
MODEM_IP="192.168.8.1"
if [ -e /usr/bin/xml_pp ]; then
pprint="/usr/bin/xml_pp";
else
pprint="/usr/bin/tee";
fi
curl -s -X GET "http://$MODEM_IP/api/webserver/SesTokInfo" > ses_tok.xml
COOKIE=`grep "SesInfo" ses_tok.xml | cut -b 58-185`
TOKEN=`grep "TokInfo" ses_tok.xml | cut -b 205-236`
send_ussd()
{
curl \
-X POST "http://$MODEM_IP/api/ussd/send" \
-H "Cookie:$COOKIE" \
-H "__RequestVerificationToken:$TOKEN" \
-H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" \
-d "<Request><Content>*136#</Content><CodeType>CodeType</CodeType></Request>"| $pprint;
}
get_ussd()
{
curl \
-X POST "http://$MODEM_IP/api/ussd/get" \
-H "Cookie: $COOKIE" \
-H "__RequestVerificationToken: $TOKEN" \
-H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" \
-d "<request><content>*136#</content><codeType>CodeType</codeType></request>"|$pprint;
}
send_ussd
sleep 10
get_ussd
结果
pi@raspberrypi:~/Projects/$ ./token.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 173 100 101 100 72 1553 1107 --:--:-- --:--:-- --:--:-- 2661
<?xml version="1.0" encoding="UTF-8"?>
<error>
<code>111016</code>
<message></message>
</error>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 160 100 88 100 72 1466 1200 --:--:-- --:--:-- --:--:-- 2711
<?xml version="1.0" encoding="UTF-8"?>
<error>
<code>125003</code>
<message/>
</error>
在
http://192.168.8.1/html/content.html#ussd
Web 界面上运行 USSD 时,我得到:
send:*136#
Received:Airtime:R0.00 Data:347.92 MB Minutes:60:00 1. XtraTime 2. Buy with Bank Card 3. Buy with YelloBucks 4. Buy with Airtime 0. More
尚未完全阅读错误代码,但这应该可以为您提供所需的帮助
[Github repo](https://github.com/if0xx/Huawei-Hilink-API/blob/master/README.md)