Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
问题是使用php和外部类发送sms_Php_Soap - Fatal编程技术网

问题是使用php和外部类发送sms

问题是使用php和外部类发送sms,php,soap,Php,Soap,我想为注册用户发送短信 我的sms getway提供程序使用SOAP将用户连接到api 这就是代码的工作原理: function sendSMS($mobile, $text){ ini_set("soap.wsdl_cache_enabled", "0"); $value = array('MY USER', 'My pass', 'my sms server number', user mobile number, $text, '1'); $url = 'http:

我想为注册用户发送短信

我的sms getway提供程序使用SOAP将用户连接到api

这就是代码的工作原理:

function sendSMS($mobile, $text){
    ini_set("soap.wsdl_cache_enabled", "0");
    $value = array('MY USER', 'My pass', 'my sms server number', user mobile number, $text, '1');
    $url = 'http://mysmsmprovider.com/WebService/V4/BoxService.asmx?wsdl';
    $method = 'SendMessage';
    $param = array('Username' => "$value[0]",'Password' => "$value[1]",'Number' => "$value[2]",'Mobile' => array("$value[3]"),'Message' => "$value[4]",'Type' => "$value[5]");
    define($security,1);
    require_once ("connection.php");
    $request = new connection($url,$method,$param);
    $message = $request->connect();
    $request->__destruct();
    unset($value,$url,$method,$param,$request);
    if ($message == 'Send Successfully'){
        return 1;
    }else{
        return 0;
    }
}
现在,connection.php文件的内容如下:

<?php
if(!defined($security)){
    header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
    die();
}
class connection{
    public $value;
    public $method;
    public $url;
    public $type;
    function __construct($url,$method,$value,$type=''){
        $this->value = $value;
        $this->method = $method;
        $this->url = $url;
        $this->type = $type;
    }
    function connect(){
        ini_set("soap.wsdl_cache_enabled", "0");
        $client = new SoapClient($this->url);
        $result = $client->__SoapCall($this->method, array($this->value));
        if($this->type == 'object')
            return get_object_vars($result);
        $merge = $this->method.'Result';
        if($result->$merge->string != '')
            return $result->$merge->string;
        else
            return $result->$merge;
    }
    function __destruct(){
        unset($this->value,$this->url,$this->method,$this->type);
    }
}
?>

但当我想在顶部使用功能时,我不能!你用安卓系统提出请求,我100%确信安卓系统的部分很好

问题是php

我不能在其他php类或php文件中使用此代码发送sms。但我以前用过同样的代码


那么你的建议是什么呢?

这是一个很模糊的问题,你的问题是什么?我的问题是函数不工作,什么都不运行,而且当我删除inlcude(“connection.php”);表单类,所有错误都将消失!