php在创建或调用webservice方面太差了,这几天在调用电信isag接口发送短信的时候是深有体会啊,当时因为懒得装java的运行环境放弃使用java改用php,现在想想太后悔了。下面是php通过socket调用isag接口发送短信的例子:
****,$sms_content,$phone);
$doc->loadXML($http_rs);
$doc->getElementsByTagName_r(“ServiceException”);
$errecord->getElementsByTagName_r(‘messageId’);
$errecord->getElementsByTagName_r(‘text’);
$messageid->item(0)->nodeValue.’=’.$tagtxt->item(0)->nodeValue;
$doc->getElementsByTagName_r(“sendSmsResponse”);
$timeout);
encoding=”UTF-8″?><soapenv:Envelope
xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”><soapenv:Header><ns1:RequestSOAPHeader
soapenv:actor=”http://schemas.xmlsoap.org/soap/actor/next”
soapenv:mustUnderstand=”0″
xmlns:ns1=”http://www.chinatelecom.com.cn/schema/ctcc/common/v2_1″><ns1:spId>SPID</ns1:spId><ns1:timeStamp>’.$timestamp.'</ns1:timeStamp><ns1:spPassword>’.$spPwd.'</ns1:spPassword><ns1:OA>tel:+86′.$phone.'</ns1:OA><ns1:FA>tel:+86′.$phone.'</ns1:FA><ns1:multicastMessaging>false</ns1:multicastMessaging></ns1:RequestSOAPHeader></soapenv:Header><soapenv:Body><sendSms
xmlns=”http://www.chinatelecom.com.cn/schema/ctcc/sms/send/v2_1/local”><addresses>tel:+86′.$phone.'</addresses><senderName>接入号</senderName><message>’.$msg_content.'</message></sendSms></soapenv:Body></soapenv:Envelope>’;
charset=utf-8\r\n”);
multipart/related, text/*\r\n”);