Mentarisms PHP on the work

03Okt06

Masih error nih.. bantuin dong.. maklum programmer amatiran..

lib-mentarisms.php

<?php
// mentari-nofunc.php
define(“MENTARISMS_USERAGENT”, “prototipe lib-mentarisms Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)”);
define(“MENTARISMS_URL”, “http://www.klub-mentari.com/index.php&#8221;);
define(“MENTARISMS_LOGIN”, “http://www.klub-mentari.com/login.php&#8221;);
define(“MENTARISMS_REDIRECT”, “sms/send_sms2.php”);
define(“MENTARISMS_KIRIM_SMS”, “http://www.klub-mentari.com/sms/xt_send_sms2.php&#8221;);

$message = “Kirim SMS Mentari via PHP”;
$recipient = “628567074554”;

/* Get sid */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, MENTARISMS_URL);
curl_setopt($ch, CURLOPT_HEADER, 1); // baca header
curl_setopt($ch, CURLOPT_USERAGENT, MENTARISMS_USERAGENT);
curl_setopt($ch, CURLOPT_COOKIEJAR, ‘cookie.txt’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // langsung return
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$indexContent = curl_exec ($ch);
error_trap($ch);
$ereg_sid = ereg(“PHPSESSID\=([0-9a-z]+)”, $indexContent, $ketemu_sid);
$sid = $ketemu_sid[1];
curl_close($ch);
echo “\$sid = $ketemu_sid[1]<br />”;

/* Login */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, MENTARISMS_LOGIN);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, MENTARISMS_USERAGENT);
curl_setopt($ch, CURLOPT_COOKIEJAR, ‘cookie.txt’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // langsung return
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$loginPost = “username=”.urlencode(“abuabbas”);
$loginPost .= “&password=”.urlencode(“adadeh”);
$loginPost .= “&sid=”.urlencode($sid);
$loginPost .= “&redirect=”.urlencode(MENTARISMS_REDIRECT);
$loginPost .= “&login=”.urlencode(“Login”);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $loginPost);
$loginContent = curl_exec ($ch);
error_trap($ch);
curl_close($ch);
$ereg_mentari = ereg(“<span class\=\”genmed\”>\+([0-9a-z]+)”, $loginContent, $ketemu_mentari);
$mentari = $ketemu_mentari[1];
echo “\$mentari = $ketemu_mentari[1]<br />”;

/* Send SMS */
$ch = curl_init();
$submit = “Kirim SMS”;
curl_setopt($ch, CURLOPT_URL, MENTARISMS_KIRIM_SMS);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, MENTARISMS_USERAGENT);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // langsung return
curl_setopt($ch, CURLOPT_COOKIEJAR, ‘cookie.txt’);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$kirimPost = “recipient=”.urlencode($recipient);
$kirimPost .= “&message=”.urlencode($message);
$kirimPost .= “&jml_kar=125&username=”.urlencode($mentari);
$kirimPost .= “&user_id=&submit=”.urlencode($submit);
curl_setopt($ch, CURLOPT_POSTFIELDS, $kirimPost);
$kirimContent = curl_exec ($ch);
echo $kirimContent;
curl_close($ch);

function error_trap($ch) {
// consider using this:
// CURLOPT_VERBOSE: Set this option to a non-zero value if you want CURL to report everything that is happening.
// CURLOPT_STDERR: The file to write errors to instead of stderr.

if (curl_errno($ch)) {
echo “cURL info:”. print_r(curl_getinfo($ch));
echo “<br>”;
echo “cURL error number:” .curl_errno($ch);
echo “<br>”;
echo “cURL error:” . curl_error($ch);
}
}
?>



5 Responses to “Mentarisms PHP on the work”

  1. Parse error: parse error in c:\apache\htdocs\sms.php on line 3

  2. baris ketiga itu harusnya nyambung, hetta

    define(”MENTARISMS_USERAGENT”, “prototipe lib-mentarisms Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)”);

    paling gampang sih paste ke PHP editor, kalo ada error2nya kan kliatan..

    begini nih kalo nggak punya file hosting (i hate to use rapidsuck). untuk masalah hosting file saya juga sedang garap skrip wget-me, mudah2an lancar biar bisa dipake..

  3. gimana tuh system curl..?/ dah aku paste di hosting knapa ko blank?? apa ada yg salah dgn pastean nya.. tlg penjelasanya.. terima kasih

  4. lib-mentarisms.php yg pake curl udah saya release lho..

  5. bung beta punya saya ko blank yah pake yg ib-mentarisms.php versi curl … gimana ya.. tlg bantuanya.makasih


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s


%d blogger menyukai ini: