Αποστολή με PHP

$text = str_replace(" ","%20",$_REQUEST["text"]); //αντικαθιστούμε το κενό με %20
$to = $_REQUEST["to"];

$post_data['userid'] = "yourid";
$post_data['password'] = "yourpass";
$post_data['to'] = "$to";
$post_data['message'] = iconv("UTF-8","Windows-1253","$text"); //μετατρέπουμε απο utf-8 σε Windows-1253 για την σωστή εμφάνιση των Ελληνικών
$post_data['from'] = 'lexicon';


//traverse array and prepare data for posting (key1=value1)
foreach ( $post_data as $key => $value) {
$post_items[] = $key . '=' . $value;
}

//create the final string to be posted using implode()
$post_string = implode ('&', $post_items);

//create cURL connection
$curl_connection = curl_init('http://www.lexiconsoftware.gr/sms/warrior.asp'); //το URL που πρέπει να κάνετε post

//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curld, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curld, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($curld, CURLOPT_COOKIEFILE, 'cookie.txt');

//set data to be posted
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);

//perform our request
$result = curl_exec($curl_connection);



echo $result; // παίρνουμε την απάντηση απο τον Server


//close the connection
curl_close($curl_connection);


 

Lexicon Software SMS Gateway - τελευταία ενημέρωση 13/7/2013