Note: If you are using someone else's bot that requires this set-up, make certain they are not using it to email themselves your password. Would be an unfortunate way to lose an account. Be careful!
So I decided that I wanted my bot to text me when it broke down. And then I decided I wanted it to text me if someone said my name in chat, or send me a PM. And then I decided I Wanted to be able to text back and talk to that person who PMed me or said my name, to 'prove' to them that I was indeed not away from my computer and quite the contrary, typing at my laptop.
Well, if you want to, I have included the steps below to do just what I did. Now, the only catch is, if you think of something else to do with this, I want to hear your great ideas. I mean, bug reports to your phone, and conversations are great anti-ban opportunities. But this concept has tons of possible applications, so let me know what you creative bunch come up with. Enjoy.
1. download the dev version of easyphp from http://www.easyphp.org/
2. make a folder on your desktop where you will keep all of your .php files
2.1 download and un-zip http://swiftmailer.org/ into the file you created in #2 .
2.2 go to your easyphp admin page, and by the text LOCAL FILES click the gray button + add an alias. And then set the folder made in step 2 as your alias.
3. Make a gmail account for this, you'll need the password and name in a minute.
4. go to C:\Program Files (x86)\EasyPHP-12.1\conf_files and edit the php.ini file
4.1 Remove the semicolon from ;extension=php_imap.dll
and from ;php_openssl
4.2 Then restart easyphp
Now, here's where you will undoubtedly edit the crap out of, but I'll give you some code snippets so you have a general idea of how to use this. you will need 2 types of files, a .php file that will do most of the work, and a simba file that will call it. Which you already knew, of course.
PHP Code:
<?php
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'username@gmail.com';
$password = 'password';
$inbox = imap_open($hostname,$username,$password);
$emails = imap_search($inbox,"UNSEEN");
if($emails) {
rsort($emails);
foreach($emails as $email_number) {
$overview = imap_fetch_overview($inbox,$email_number,0);
//echo $overview[0]->subject."\n";
$message = imap_fetchbody($inbox,$email_number,1);
echo $message; // Prints the message in Text format.
}
}
/* close the connection */
imap_close($inbox);
?>
This will grab all the "UNSEEN" emails in your gmail and put the body text up. (NOTE: the body text from a text message will have an enter (#13#10) at the end of it, so be careful when comparing strings);
if you mess around with the
PHP Code:
echo $overview[0]->subject."\n";
you can change the word subject to anything you want to get different parts of the message.
now for sending emails:
PHP Code:
<?php
require_once 'swift/lib/swift_required.php';
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, "ssl")
->setUsername('username') //don't use @gmail.com
->setPassword('password');
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Title Of the Message Here')
->setFrom(array('username@gmail.com' => 'ABC'))
->setTo(array('phoneNumber@vtext.com'))
->setBody('The Message Here');
$result = $mailer->send($message);
?>
will send a message when the page is ran to the phone number, I only included the verizon email extension, just google for the others if you don't use verizon.
you're phone can only accept 160 digit messages, I haven't experimented around with what happens if you send a larger message *yet*. may error, or may send in pieces to your phone.
Note: to be able to run php files from easyPhP admin page you must have them saved with the .php extension! (just text files, this should bring back memories from html when you were a child).
SIMBA TIME
Now we are at the simba portion, everything above has been set up, and we want simba to call those pages. Well, you're in luck, simba has a built in function to run pages, just use getpage('url here'); and you're good, you get the URL by running the web page from easyPHP admin page (which you can open from the easyphp widget). and then clicking on the alias you added under LOCAL FILES. you'll get a list of files you can click on, and then once you open them copy the URL. and you can now access the PHP code from simba!!! YAY!!!! :D
I've included some examples of simba code (just reading it so far, I haven't actually made a function that uses it effectively, *yet*). The errors I ran into simba side mostly had to do with the enter at the end of each text. the rest runs pretty smoothly.
Simba Code:
program new;
var
x , i: integer ;
sting: string;
begin
getpage('http://theOneThatSends.php'); // Sends, in theory.
repeat
sting := GetPage('http://theOneThatreads.php');
//These lines below I used as diagnostics to figure out which ascii characters were throwing me off. only necessary for error finding.
writeln(sting);
writeln(inttostr(length(sting)));
for i := 1 to length(sting) do
begin
writeln(sting[i]);
writeln(inttostr(ord(sting[i])));
end;
//writeln(booltostr(sting = 'hello' + #13#10));
//writeln(GetPage('http://127.0.0.1/MySite/read.php'));
//Should send a message back if the message recieved in the email is 'hello'
if(sting = 'hello' + #13#10then
begin
getpage('http://127.0.0.1/MySite/first.php'); // Sends
end
else begin
//Send error back here!!
end;
until(false);
end.
Well, if you have any questions, ask them below. If you have any suggestions, mention them. And if you have any great idea's I should add, also let me know below.
I wrote this tutorial because the SRL/villavu community has helped me a lot. A good portion of you are stuck up assholes, but you stuck up assholes generally answer my idiotic scripting questions. I owe quite a few of you a lot for all the help I've gotten. I hope you enjoyed this tutorial, if you have any other crazy idea's that would make botting better like this one feel free to let me know, I love a challenge.