Ok Find attached in text format.

Hillel <[EMAIL PROTECTED]> wrote: Hi Michael,

I'm testing with WAP Push and tried to download the code you put on the
Internet from Juan Nin.

Unfortunately if you try and download it via the Kannel User mailing list
from 
http://www.mail-archive.com/users@kannel.org/msg11736.html you get the
error:
Fatal error: Call to undefined function curl_init() in
/data1/archive/users@kannel.org/msg11736/wappush.php on line 46

If you click on save from the website you get:


Fatal error:  Call to undefined function curl_init() in
/data1/archive/users@kannel.org/msg11736/wappush.php on line
46


Please will you resend it and save the file as .txt with instructions for
the reader to save it as wappush.php as it's trying to run on the server
when you try save it or open it.

Thanks







Regards,
Mike Nwaogu
Tel: 234_802_325_6437
Eml: [EMAIL PROTECTED]
       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
<?
$country_code = '234';
$phone = '8023256437';
$push_url = "http://wap.google.com";;
$text = 'Test Google url';
$smsc_id  = 'sms_4';

$out = send_wap_push($smsc_id, $country_code, $phone, $push_url, $text);
echo $out;

function send_wap_push($smsc_id, $country_code, $phone, $push_url, $text)
{
        $host = 'localhost';
        $port = '8082';
        $url  =  "http://$host:$port";;
        
        $ppg_user = '1defcom';
        $ppg_pass = '1mocdef';
        
        $wap_push_id = get_rand_numbers(5);
        $body = "--multipart-boundary\r\n".
                        "Content-type: application/xml\r\n\r\n".
                        '<?xml version="1.0"?>'."\r\n".
                        '<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 
1.0//EN"'."\r\n".
                        '"http://www.wapforum.org/DTD/pap_1.0.dtd"; >'."\r\n".
                        '<pap>'."\r\n".
                        '<push-message push-id="'.$wap_push_id.'">'."\r\n\t".
                        '<address 
address-value="WAPPUSH=+'.$country_code.$phone.'/[EMAIL PROTECTED]"/>'."\r\n\t".
                        '<quality-of-service delivery-method="unconfirmed" 
network="GSM" bearer="SMS"/>'.
                        "\r\n</push-message>\r\n".
                        "</pap>\r\n\r\n".
                        "--multipart-boundary\r\n".
                        "Content-type: text/vnd.wap.si\r\n\r\n".
                        '<?xml version="1.0"?>'."\r\n".
                        '<!DOCTYPE si PUBLIC "-//WAPFORUM//DTD SI 
1.0//EN"'."\r\n".
                        '"http://www.wapforum.org/DTD/si.dtd";>'."\r\n".
                        "<si>\r\n".
                        '<indication action="signal-high" 
si-id="'.$wap_push_id.'" href="'. $push_url .'">'.$text.'</indication>'."\r\n".
                        "</si>\r\n"."--multipart-boundary--\r\n";

        $post = "POST /wappush HTTP/1.1\r\n"."Host: $host:$port\r\n".
                "Authorization: Basic 
".base64_encode("$ppg_user:$ppg_pass")."\r\n".
                "X-Kannel-SMSC: $smsc_id\r\n".'Content-Type: multipart/related; 
boundary=multipart-boundary; type="application/xml"'."\r\n".
                "Content-Length: ".strlen($body)."\r\n"."\r\n".$body;

        $ch = curl_init();
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 15);
        curl_setopt ($ch,CURLOPT_CUSTOMREQUEST , $post);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $reply = curl_exec($ch);
        curl_close ($ch);
        return $reply;  
//      print_r($post.$body);
}

function assign_rand_value($num)
{
// accepts 1 - 36
  switch($num)
  {
    case "1":
     $rand_value = "a";
    break;
    case "2":
     $rand_value = "b";
    break;
    case "3":
     $rand_value = "c";
    break;
    case "4":
     $rand_value = "d";
    break;
    case "5":
     $rand_value = "e";
    break;
    case "6":
     $rand_value = "f";
    break;
    case "7":
     $rand_value = "g";
    break;
    case "8":
     $rand_value = "h";
    break;
    case "9":
     $rand_value = "i";
    break;
    case "10":
     $rand_value = "j";
    break;
    case "11":
     $rand_value = "k";
    break;
    case "12":
     $rand_value = "l";
    break;
    case "13":
     $rand_value = "m";
    break;
    case "14":
     $rand_value = "n";
    break;
    case "15":
     $rand_value = "o";
    break;
    case "16":
     $rand_value = "p";
    break;
    case "17":
     $rand_value = "q";
    break;
    case "18":
     $rand_value = "r";
    break;
    case "19":
     $rand_value = "s";
    break;
    case "20":
     $rand_value = "t";
    break;
    case "21":
     $rand_value = "u";
    break;
    case "22":
     $rand_value = "v";
    break;
    case "23":
     $rand_value = "w";
    break;
    case "24":
     $rand_value = "x";
    break;
    case "25":
     $rand_value = "y";
    break;
    case "26":
     $rand_value = "z";
    break;
    case "27":
     $rand_value = "0";
    break;
    case "28":
     $rand_value = "1";
    break;
    case "29":
     $rand_value = "2";
    break;
    case "30":
     $rand_value = "3";
    break;
    case "31":
     $rand_value = "4";
    break;
    case "32":
     $rand_value = "5";
    break;
    case "33":
     $rand_value = "6";
    break;
    case "34":
     $rand_value = "7";
    break;
    case "35":
     $rand_value = "8";
    break;
    case "36":
     $rand_value = "9";
    break;
  }
return $rand_value;
}

function get_rand_numbers($length)
{
  if($length>0) 
  { 
  $rand_id="";
   for($i=1; $i<=$length; $i++)
   {
   mt_srand((double)microtime() * 1000000);
   $num = mt_rand(27,36);
   $rand_id .= assign_rand_value($num);
   }
  }
return $rand_id;
}

?>

Reply via email to