1.先安装soap扩展sudo yum install php-soap

2.安装openssL

3.function  issure($sn){//通过soap链接接口  进行确认是否是正确的sn码
    try{
        $client = new SoapClient("https://118.124.139.234/gethtc.php?wsdl",array('soap_version'=> SOAP_1_2,"trace"=>true,"exceptions"=>false,'ssl_method'=>3));

        $sn = $client->getstatusBysn(array('smn'=>$sn));
        $pd=0;
        if($sn->getstatusBysnResult  === true){
            $pd=1;
        }else if($sn->getstatusBysnResult  === false){
            $pd=0;
        }else{
            $pd=0;
//            echo "未知".$sn->getstatusBysnResult;
        }
    }catch (SoapFault $e){
        $pd=0;
//        echo "未知".$sn->getstatusBysnResult;
    }
    return $pd;
}

posted on 2014-05-30 11:00  幸福之家128817  阅读(407)  评论(0编辑  收藏  举报