Hi,
Can enybody give me an example PHP script for sending WAP PUSH? It is not
very well documented how to do POST request (like for SMS messages: Using
the HTTP interface to send SMS messages). In User Guide there is table with
SMS Push CGI Variables, but nothing about WAP PUSH POST variables and
headers.

And maybe you can tell me why this is not working:
function http_post($server, $port, $url, $vars) {
        $user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)";

        $urlencoded = "";
        while (list($key,$value) = each($vars))
                $urlencoded.= urlencode($key) . "=" . urlencode($value) .
"&";
        $urlencoded = substr($urlencoded,0,-1); 

        $content_length = strlen($urlencoded);

        $headers = "POST $url HTTP/1.0
Content-Type: multipart/related; type=application/xml;
boundary=EndOfOneEntity
User-Agent: $user_agent
Host: $server
Connection: Keep-Alive
Cache-Control: no-cache
Content-Length: $content_length

";
        
        $fp = fsockopen($server, $port, $errno, $errstr);
        if (!$fp) {
                return false;
        }

        fputs($fp, $headers);
        fputs($fp, $urlencoded);
        
        $ret = "";
        while (!feof($fp))
                $ret.= fgets($fp, 1024);
    
        fclose($fp);
        
        return $ret;
}

http_post("MY IP", 8080, "/cgi-bin/wappush", array("user" => "wap_sender",
"pass" => "MY PASS", "to" => "MY PHONE NUMBER", "text" =>
"3D%02%06%17%AE%96localhost%3A8080%00%AF%80%8D%CF%B4%80%02%05j%00E%C6%0C%03w
ap.iobox.fi%00%11%031%40wiral.com%00%07%0A%C3%07%19%99%06%25%15%23%15%10%C3%
04+%02%060%01%03Want+to+test+a+fetch%3F%00%01%01", "udh" =>
"%06%05%04%0B%84%23%F0"));


Reply via email to