【问题标题】:returning server response and display in the same page返回服务器响应并显示在同一页面中
【发布时间】:2012-12-13 09:14:04
【问题描述】:

我已经尝试运行这个脚本好几个星期了。

我想要的是将数据发送到那里显示的服务器并返回服务器响应,但我从响应中得到的只是 url 但 url 没有执行它只会显示在响应变量上

<?php
class send
{

    public $username;
    public $password;
    public $destination;
    public $sender;
    public $msg;
    public $type;
    public $dlr;
    public $url;

    function __construct()
    {
    }

    function send_sms(){
        $posturl = 'http://121.241.242.114:8080/bulksms/bulksms?';
        $number = $this->destination;

        $msg = urlencode($this->msg);
        $type='0';
        $dlr='1';
        $url='';
        $posturl = $posturl."source=".$this->sender."&username=".$this->username."&password=".$this->password."&type=".$type."&dlr=".$dlr."&destination=".$number."&message=".$msg;
        $ch = curl_init(); 
        curl_setopt($ch, CURLOPT_URL, $posturl); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
        curl_setopt($ch, CURLOPT_POST, true);
        $response = curl_exec($ch); 
        return $posturl;
    }

}
?>

【问题讨论】:

    标签: php ajax post curl


    【解决方案1】:
    return $response; //and not $posturl
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多