Laman

Senin, 20 Desember 2010

Unlimited SMS Mentari

Berikut adalah cara pembuatan script untuk Unlimited SMS Mentari. Script asli berasal dari Mas Wiwid. Script2x berikut ini akan sangat bermanfaat bagi anda semua sebagai cadangan bilamana script PHP SMS IM3 tidak berfungsi. Karena portal IM3 kurang stabil, entah karena banyak transaksi atau hal lainnya. Gunakanlah script berikut ini dengan bijak.

Langkah I:
Pertama-tama buat file library dahulu. Ketikkan/salin script berikut ini ke notepad lalu simpan dengan nama mtsmslib.php. jangan lupa ubah Save As Type yang tadinya *.txt menjadi All Files.

/**
* M3SMSlib.php
* modified April 2007 By. MaZ WiWiD
**/

define("M3SMS_USERAGENT", "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
define("M3SMS_URL", "http://www.klub-mentari.com/index.php");
define("M3SMS_LOGIN", "http://www.klub-mentari.com/login.php");
define("M3SMS_REDIRECT", "sms/send_sms.php");
define("M3SMS_FORMSMS", "http://www.klub-mentari.com/sms/send_sms.php");
define("M3SMS_KIRIM_SMS", "http://www.klub-mentari.com/sms/xt_send_sms2.php");
define("M3SMS_LOGOUT", "http://www.klub-mentari.com/account/logout.php");

define("m3_COOKIE_PATH", "./");

class M3SMS {
var $username;
var $password;
var $m3;

var $version;
var $created;
var $cookie_string;
var $cookie;
var $proxy_host;
var $proxy_auth;
var $sid;
var $is_login;
var $sent;
var $ch; // curl handle
var $status_log = array();
var $status;

function M3SMS() {
$this->version = "1.0";
$this->created = true;
if (!extension_loaded('curl')) {
if (isset($_ENV["NUMBER_OF_PROCESSORS"]) and ($_ENV["NUMBER_OF_PROCESSORS"] > 1)) {
$this->created = false;
$a = array(
"action" => "constructing M3SMS object",
"status" => "failed",
"message" => "lib-M3SMS: Using a multithread server. Ensure php_curl.dll has been enabled (uncommented) in your php.ini."
);
array_unshift($this->status_log, $a);

} else {
if (!dl('php_curl.dll') && !dl('curl.so')) {
$this->created = false;
$a = array(
"action" => "constructing M3SMS object",
"status" => "failed",
"message" => "lib-M3SMS: unable to load curl extension."
);
array_unshift($this->status_log, $a);
}
}
}
if (!function_exists("curl_setopt")) {
$this->created = false;
$a = array(
"action" => "constructing M3SMS object",
"status" => "failed",
"message" => "lib-M3SMS: No curl."
);
array_unshift($this->status_log, $a);
}
$this->username = $username;
$this->password = $password;
$this->proxy_host = "";
$this->proxy_auth = "";
$this->use_session = 2;
if ($this->created == true) {
$a = array(
"action" => "constructing M3SMS object",
"status" => "success",
"message" => "lib-M3SMS: Constructing completed."
);
array_unshift($this->status_log, $a);
}
//$this->Login();
}

function setProxy($proxy_host, $proxy_user, $proxy_pass) {
if (strlen($this->proxy_host) > 0) {
$this->proxy_host = $proxy_host;
if (strlen($proxy_user) > 0 || strlen($proxy_pass) > 0) {
$this->proxy_auth = $proxy_user.":".$proxy_pass;
}
$a = array(
"action" => "set proxy",
"status" => "success",
"message" => "lib-M3SMS: Proxy set."
);
array_unshift($this->status_log, $a);
} else {
$a = array(
"action" => "set proxy",
"status" => "failed",
"message" => "lib-M3SMS: no hostname supplied."
);
array_unshift($this->status_log, $a);
}
}

function CURL_PROXY($cc) {
if (strlen($this->proxy_host) > 0) {
curl_setopt($cc, CURLOPT_PROXY, $this->proxy_host);
if (strlen($this->proxy_auth) > 0)
curl_setopt($cc, CURLOPT_PROXYUSERPWD, $this->proxy_auth);
}
}

function Login($username, $password){
$this->cookie = m3_COOKIE_PATH."m3@cookie.txt";
$this->username = $username;
$this->password = $password;

/* looking for sid */
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_URL, M3SMS_URL);
$this->CURL_PROXY($this->ch);
curl_setopt($this->ch, CURLOPT_HEADER, 1); // baca header
curl_setopt($this->ch, CURLOPT_USERAGENT, M3SMS_USERAGENT);
curl_setopt($this->ch, CURLOPT_COOKIE, $this->cookie_string);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookie);
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookie);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
$indexContent = curl_exec($this->ch);
$ereg_sid = ereg("PHPSESSID\=([0-9a-z]+)", $indexContent, $ketemu_sid);
$this->sid = $ketemu_sid[1];

/* Login */
curl_setopt($this->ch, CURLOPT_URL, M3SMS_LOGIN);
$this->CURL_PROXY($this->ch);
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_USERAGENT, M3SMS_USERAGENT);
curl_setopt($this->ch, CURLOPT_COOKIE, $this->cookie_string);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookie.txt);
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookie.txt);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
$loginPost = "username=".urlencode($this->username);
$loginPost .= "&password=".urlencode($this->password);
$loginPost .= "&sid=".urlencode($this->sid);
$loginPost .= "&redirect=".urlencode("index.php");
$loginPost .= "&login=".urlencode("Log in");
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $loginPost);
$loginContent = curl_exec($this->ch);
$this->lihatErrorCurl($this->ch);
// curl_close($this->ch);
}

function kirimSms($recipient, $message) {
// FORM SMS
curl_setopt($this->ch, CURLOPT_URL, M3SMS_FORMSMS);
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_USERAGENT, M3SMS_USERAGENT);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1); // langsung return
curl_setopt($this->ch, CURLOPT_VERBOSE, 1);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
$formSMSContent = curl_exec ($this->ch);
if(empty($this->m3)) {
$ereg_m3 = ereg("\+([0-9a-z]+)", $formSMSContent, $ketemu_m3);
$this->m3 = $ketemu_m3[1];
//echo "\$m3 = $ketemu_m3[1]
";
}
// KIRIM SMS
$this->recipient = $recipient;
$this->message = $message;
curl_setopt($this->ch, CURLOPT_URL, M3SMS_KIRIM_SMS);
$this->CURL_PROXY($this->ch);
curl_setopt ($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_REFERER, M3SMS_FORMSMS);
curl_setopt ($this->ch, CURLOPT_COOKIE, $this->cookie_string);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
$kirimPost = "recipient=".urlencode($this->recipient);
$kirimPost .= "&message=".urlencode($this->message);
$kirimPost .= "&jml_kar=125";
$kirimPost .= "&username=".urlencode($this->m3);
$kirimPost .= "&user_id=&submit=".urlencode("Kirim SMS");
curl_setopt ($this->ch, CURLOPT_POSTFIELDS, $kirimPost);
$kirimContent = curl_exec($this->ch);
$infoKirim = curl_getinfo($this->ch);

if($kirimContent) {
if(ereg("masuk antrian", $kirimContent)) { $this->status = "terkirim"; }
elseif(ereg("Wah, sms hari ini dah 10 sms nih", $kirimContent)) { $this->status = "over-limit"; }
} else {
if (empty($infoKirim['http_code'])) {
$this->status = "No HTTP code was returned";
} else {
$this->status = $infoKirim['http_code'];
}
}
$this->lihatErrorCurl($this->ch);
// curl_close($this->ch);

}

function terkirim() {
return $this->terkirim;
}

function lihatStatusLog() {
print implode("
\n", $this->status_log);
}

function status() {
return $this->status;
}

function lihatErrorCurl($ch) {
if (curl_errno($this->ch)) {
echo "cURL info:". print_r(curl_getinfo($this->ch));
echo "
";
echo "cURL error number:" .curl_errno($this->ch);
echo "
";
echo "cURL error:" . curl_error($this->ch);
}
}
}
?>

Langkah II:
Setelah membuat file library selanjutnya buat file untuk kirim sms.
Ketikkan/salin script berikut ini ke notepad lalu simpan dengan nama smsmt.php. jangan lupa ubah Save As Type yang tadinya *.txt menjadi All Files. Isikan username_mentari_kamu dengan username milik kamu sendiri. kemudian isikan password_mentari_kamu dengan password milik kamu sendiri.

include("mtsmslib.php");
$username = "username_mentari_kamu";
$password = "password_mentari_kamu";

echo "



Free Mentari SMS MaZ WiWiD



";

if($_POST['message'] && $_POST['recipient']) {
$m3 = new m3sms();
$m3->Login($username, $password);
$m3->kirimSms($_POST['recipient'], $_POST['message']);
echo "

Laporan



Laporan




m3."\">











status()."\">






";
}
else {
echo "
SMS gratis Mentari (c)2007 MaZ WiWiD Project

Free SMS




SMS Gratis Mentari














characters left








  • By. MaZ WiWiD(wiwidbatman@yahoo.com)






";
}

echo "

";
?>

Langkah III:
Terakhir bikin file WML(Wireless Mobile Language) supaya bisa diakses handphone jadoel. Ketikkan/salin script berikut ini ke notepad lalu simpan dengan nama index.wml. jangan lupa ubah Save As Type yang tadinya *.txt menjadi All Files.




">


Recipient:



Message:




Send SMS






Smile mas ikatama 2007





Langkah IV:
Ketikkan/salin script berikut ini ke notepad lalu simpan dengan nama index.html. jangan lupa ubah Save As Type yang tadinya *.txt menjadi All Files.








SMS Gratis via Internet




SMS Gratis Mentari














characters left












Langkah V:
Daftar ke http://www.110mb.com dan upload keempat file yang telah dibuat pada Langkah I s/d IV tadi. Bila ada permintaan overwrite, langsung klik tombol Yes ajah. Kemudian uji cobalah akses dari handphone anda masing-masing. Misal alamat hosting yang dibuat adalah http://mashan.110mb.com maka untuk mengaksesnya dari handphone yaitu dengan mengetikkan URL berikut ini: http://mashan.110mb.com/index.wml .Tetapi bilamana ingin menggunakannya melalui Web Browser maka dapat mengaksesnya dengan mengetikkan http://mashan.110mb.com/index.html
sumber dari : www.sekuritionline.net

Tidak ada komentar:

Posting Komentar