在PHP中显示短信列表-使用华为加密狗E8372

时间:2018-11-27 05:31:29

标签: php sms token php-curl huawei

我正在使用Huawei E8372,用于在PHP中显示我的短信列表

我尝试了一个代码,但是没有用

显示错误125002

在我的代码下面

$MODEM_IP="192.168.8.1";
$ch = curl_init("http://$MODEM_IP/api/webserver/SesTokInfo");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$txResult = curl_exec($ch);
//echo $txResult;
$Token=substr($txResult,57,32);
$Session=substr($txResult,108,128);
//echo $Token;
//echo $Session;
$url = "http://192.168.8.1/api/sms/sms-list";
//echo $url;
//exit();
$data='<request><PageIndex>1</PageIndex><ReadCount>3</ReadCount><BoxType>1</BoxType><SortType>0</SortType><Ascending>0</Ascending><UnreadPreferred>1</UnreadPreferred></request>';
$ch = curl_init();
$params = array('Username' => "XXX",
'Password'=>"XXX",'data'=>$data);

curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($params));
curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);    
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'__RequestVerificationToken'=> $Token, "Content-Type"=>'text/xml'
));
curl_setopt($ch, CURLOPT_COOKIE, 'Cookie='.$Session);
$result = curl_exec($ch);
echo "<Br>".$result."<BR>";

0 个答案:

没有答案