SEND YM WITH PHP

Einfach Dinge, die nichts mit XAMPP, Apache Friends, Apache, MySQL, PHP und alle dem zu tun haben. Allerlei halt. ;)

SEND YM WITH PHP

Postby Ghafoer86 » 08. February 2015 19:53

i have a code to send an instant messaging (ym) with php using Curl, but the script isn't working.
Code: Select all
<?php
// get home page of yahoo mobile
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://us.m1.yahoo.com/p/login");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_ENCODING, "");
curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_yahoo_messenger.cookie');
$curl_data = curl_exec($curl);
curl_close($curl);
// do login to yahoo messenger (mobile version)
$yahoo_id = "ghafoer86"; // your yahoo id
$yahoo_id_password = "********"; // your yahoo id password
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://us.m1.yahoo.com/p/login/auth?ignore=sign+in");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, "_done=&_pc=&_src=&_ts=&_sig=&_css=&_intl=&_second_user=no&username=" . $yahoo_id . "&password=" . $yahoo_id_password . "&action=Sign+in");
curl_setopt($curl, CURLOPT_ENCODING, "");
curl_setopt($curl, CURLOPT_COOKIEFILE, getcwd() . '/cookies_yahoo_messenger.cookie');
curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_yahoo_messenger.cookie');
$curl_data = curl_exec($curl);
curl_close($curl);
// get home page of mobile messenger
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://us.m1.yahoo.com/p/messenger");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_ENCODING, "");
curl_setopt($curl, CURLOPT_COOKIEFILE, getcwd() . '/cookies_yahoo_messenger.cookie');
curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_yahoo_messenger.cookie');
$curl_data = curl_exec($curl);
curl_close($curl);
// get home page url of mobile messenger with contact lists
$url_get = $curl_data;
$url_get = substr($url_get, strpos($url_get, "/p/messenger"));
$url_get = substr($url_get, 0, strpos($url_get, "\""));
$url_get = "http://us.m1.yahoo.com" . urldecode($url_get);
// get home page of mobile messenger with contact lists
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url_get);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_ENCODING, "");
curl_setopt($curl, CURLOPT_COOKIEFILE, getcwd() . '/cookies_yahoo_messenger.cookie');
curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_yahoo_messenger.cookie');
$curl_data = curl_exec($curl);
curl_close($curl);
// persiapan untuk mendapatkan variable untuk send message yahoo messenger
$url_get = $curl_data;
$url_get = substr($url_get, strpos($url_get, "/p/messenger/chat?"));
$url_get = substr($url_get, 0, strpos($url_get, "\""));
$url_get = "http://us.m1.yahoo.com" . urldecode($url_get);
// akses ke form send message yahoo messenger
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url_get);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_ENCODING, "");
curl_setopt($curl, CURLOPT_COOKIEFILE, getcwd() . '/cookies_yahoo_messenger.cookie');
curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_yahoo_messenger.cookie');
$curl_data = curl_exec($curl);
curl_close($curl);
// preparation for get post url for send message
$post_url = $curl_data;
$post_url = substr($post_url, strpos($post_url, "action=") + 8);
$post_url = substr($post_url, 0, strpos($post_url, "\""));
$post_url = "http://us.m1.yahoo.com" . urldecode($post_url);
// target yahoo id and message
$yahoo_username = "ghafoer@rocketmail.com";
$yahoo_message = "testing";
// do send message to target yahoo id
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $post_url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, "user=" . $yahoo_username . "&message=" . $yahoo_message . "&wmlfix=Send");
curl_setopt($curl, CURLOPT_ENCODING, "");
curl_setopt($curl, CURLOPT_COOKIEFILE, getcwd() . '/cookies_yahoo_messenger.cookie');
curl_setopt($curl, CURLOPT_COOKIEJAR, getcwd() . '/cookies_yahoo_messenger.cookie');
$curl_data = curl_exec($curl);
curl_close($curl);
echo "pesan Anda sudah terkirim ke Yahoo! ID: " . $yahoo_username;
?>

Please help me to solved this problem :cry: :cry: :cry:
Never Stop Learning. Make Different's Style. Leading The Innovation.
User avatar
Ghafoer86
 
Posts: 20
Joined: 12. August 2013 17:39
Location: Indonesia - southeast ASIA (City : Palu Province : Central Sulawesi)
XAMPP version: 1.8.3-2
Operating System: Android Marshmallow

Re: SEND YM WITH PHP

Postby Ghafoer86 » 08. February 2015 20:11

i have try to enter the url of yahoo mobile (http://us.m1.yahoo.com/p/login) and the url isn't valid.
Image
and now i have been change the url to be "http://id.m1.yahoo.com/p/login/auth?ignore=sign+in". But still not work.
so, plese help me to solved this problem or may be there is anybody have the script send instant messaging with YM or GTalk. :cry: :cry: :cry: :cry:
Never Stop Learning. Make Different's Style. Leading The Innovation.
User avatar
Ghafoer86
 
Posts: 20
Joined: 12. August 2013 17:39
Location: Indonesia - southeast ASIA (City : Palu Province : Central Sulawesi)
XAMPP version: 1.8.3-2
Operating System: Android Marshmallow


Return to Allerlei

Who is online

Users browsing this forum: No registered users and 1 guest