向第三方发送GET

时间:2012-11-22 17:13:10

标签: php forms post get sms

我正在尝试设置SMS系统并使用aql.com发送短信(SMS)。

这在浏览器中运行良好:   http://gw1.aql.com/sms/postmsg.php?to_num=447943417499&message=HELLO&flash=0&originator=Me&username= &安培;密码= ***

我使用简单的header()函数让它在PHP中工作。我现在无法使用header,ob_start / flush,fsock等工作。

在此实例中发送GET请求的最佳和可靠方法是什么。我可以有一个基本的例子吗?

提前致谢: - )

[编辑]收到短信后,通过短信服务提供商请求页面,因此调试非常困难,特别是在共享主机上!

2 个答案:

答案 0 :(得分:2)

首先,这项服务有here

的梨类

这里还有另一个实现:

function dosmsend($number, $message, $flash = "") {
    // your aql username and password
    $username = "yourusername";
    $password = "yourpassword";

    $weburl = "http://gw1.aql.com/sms/postmsg.php";

    // encodes your message for sending on the web
    $message = urlencode($message);


    // the request string
    $smsurl = "$weburl?username=$username&password=$password&to_num=$number&message=$message";


    // if $flash is set to 1, it will add the flash request onto the query
    if ($flash == "1")
        $smsurl .= "&flash=1";

    // connects to server to send message
    if ($content_array = file($smsurl)) {
        $content = implode("", $content_array);

        // check for response
        if (eregi("AQSMS-AUTHERROR", $content))
        echo "There was an authenication error";
        elseif (eregi("AQSMS-NOMSG", $content))
        echo "There was no message or mobile number";
        elseif (eregi("AQSMS-OK", $content))
        echo "The Message was queued succcessfully";
        elseif (eregi("AQSMS-NOCREDIT", $content))
        echo "Your account has no credit";
    }
    else
        echo "There was an error connecting to the server";
}

dosmsend("09978123456", "this is a test message");

//or 
//dosmsend("09978123456","this is a test flash message oo!","1");

答案 1 :(得分:0)

对于大多数商业场景,与第三方打交道应该保持在一个极限,因为您希望尽可能多地控制您的操作,除非涉及联盟营销业务和致富的概念。这些计划。