Results 1 to 18 of 18

Thread: Text Messaging

  1. #1
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default Text Messaging

    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.
    Last edited by xdarkshadowx; 01-02-2013 at 03:03 AM.

  2. #2
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Savin' this spot.
    Last edited by xdarkshadowx; 01-02-2013 at 12:56 AM.

  3. #3
    Join Date
    Feb 2012
    Posts
    390
    Mentioned
    2 Post(s)
    Quoted
    14 Post(s)

    Default

    So you finally wrote the tutorial! Fantastic!
    On the administration page thing I keep getting cannot connect to my webpage at 127.0.0.1

    Any ideas?
    ~Iso
    Previously known as fisherblue23(Please be kind!)
    [RSGP]CLICK HERE FOR GFX TO BE DONE BY ME
    [FREE]CLICK HERE FOR GFX TO BE DONE BY ME

  4. #4
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Mhmm! let me know if I forgot something. My friend helped me with this so it's possible I forgot a step. but it should be all their.

    OH, does anyone know if their is part of simba that runs as the script terminates? like a onQuit() function? cause it would be nice to have it text me if the script dies..
    Non-RS scripter, if you need a hand with scripting let me know. I have a decent amount of experience scripting for non-RS games.

    How to add text messaging to any script: http://villavu.com/forum/showthread....98#post1151998

  5. #5
    Join Date
    Feb 2012
    Posts
    390
    Mentioned
    2 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by xdarkshadowx View Post
    Mhmm! let me know if I forgot something. My friend helped me with this so it's possible I forgot a step. but it should be all their.

    OH, does anyone know if their is part of simba that runs as the script terminates? like a onQuit() function? cause it would be nice to have it text me if the script dies..
    Im not sure. ask around
    ~Iso
    Previously known as fisherblue23(Please be kind!)
    [RSGP]CLICK HERE FOR GFX TO BE DONE BY ME
    [FREE]CLICK HERE FOR GFX TO BE DONE BY ME

  6. #6
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Quote Originally Posted by xdarkshadowx View Post
    Mhmm! let me know if I forgot something. My friend helped me with this so it's possible I forgot a step. but it should be all their.

    OH, does anyone know if their is part of simba that runs as the script terminates? like a onQuit() function? cause it would be nice to have it text me if the script dies..
    Simba Code:
    AddonTerminate('YourProcedure');
    I believe

  7. #7
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by IsoMorphic View Post
    So you finally wrote the tutorial! Fantastic!
    On the administration page thing I keep getting cannot connect to my webpage at 127.0.0.1

    Any ideas?
    Save it as a .php, forgot to include that.
    Non-RS scripter, if you need a hand with scripting let me know. I have a decent amount of experience scripting for non-RS games.

    How to add text messaging to any script: http://villavu.com/forum/showthread....98#post1151998

  8. #8
    Join Date
    Apr 2012
    Posts
    3,356
    Mentioned
    34 Post(s)
    Quoted
    218 Post(s)

    Default

    Wow great guide!

    Not all of us are stuck up!!

    This is really clever. Well done.

  9. #9
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by -Benny View Post
    Wow great guide!

    Not all of us are stuck up!!

    This is really clever. Well done.
    Thanks! Glad you enjoyed it.
    Non-RS scripter, if you need a hand with scripting let me know. I have a decent amount of experience scripting for non-RS games.

    How to add text messaging to any script: http://villavu.com/forum/showthread....98#post1151998

  10. #10
    Join Date
    Apr 2015
    Posts
    20
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Awesome thread!

    Just set this up as of 05-10-2015, so whoever wants to implement this should at least know everything is still working.

    I had a few struggles in understanding this tutorial, but I think it was just due to my lack of experience when it comes to EasyPhp. The main thing that took me a while is once you set up your folder under the administrator page as a local folder, you can click on the name of your folder under local files to run any .php script you created. If you're struggling, just read EasyPHP - a quick starter guide.

    Thanks!

  11. #11
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Yeah I apologize. I have no php experience so I was relying on code snippets and random walkthroughs, luckily I had a friend who knew enough php to fix my idiotic mistakes.

    I'm glad it's still functional. I hope it serves you well!
    Non-RS scripter, if you need a hand with scripting let me know. I have a decent amount of experience scripting for non-RS games.

    How to add text messaging to any script: http://villavu.com/forum/showthread....98#post1151998

  12. #12
    Join Date
    Apr 2015
    Posts
    20
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    So I just came back to this tutorial because I was trying to use this again. I could have sworn I didn't change anything and it suddenly wasn't working.

    Turns out gmail has done a major overhaul of their security in the last year, so if you were using gmail to send your mails, then this tutorial would have stopped working. I would add this to your tutorial otherwise people will probably get very discouraged. You now have to go to https://myaccount.google.com/, while logged into your google account, click on settings, then change the "allow less secure apps" from off to on. This will allow swiftmailer to access your gmail account. Otherwise gmail blocks you.

    Cheers.

  13. #13
    Join Date
    Nov 2015
    Posts
    20
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default

    Was going to set this up for my own cute little bot and would 100% have gotten stuck at this. Thanks a lot man. Btw, do you know if it would still work if I just follow this guide?

  14. #14
    Join Date
    Apr 2015
    Posts
    20
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by rune3132 View Post
    Was going to set this up for my own cute little bot and would 100% have gotten stuck at this. Thanks a lot man. Btw, do you know if it would still work if I just follow this guide?
    Yeah it still works. I remember when I first set it up I got a little stuck getting to the easyphp admin page. You can get to it by clicking on window's hidden icons (usually next to time/date in bottom right corner), right clicking easyphp icon and opening admin page from there.

    Feel free to pm me if you get stuck.

  15. #15
    Join Date
    Feb 2013
    Posts
    103
    Mentioned
    0 Post(s)
    Quoted
    32 Post(s)

    Default

    This is awesome. Thanks a bunch.

  16. #16
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Should utilize some api like http://textbelt.com/

  17. #17
    Join Date
    Jan 2014
    Location
    NE Europe
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Not going to implement it myself, as I have remote access available at almost all times. But I have to say, that it's a brilliant idea and I admire your creativity

  18. #18
    Join Date
    Feb 2012
    Posts
    170
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Thanks for figuring that out! I'll try to run through this whole thing and give it a much needed facelift. Good to hear it still works though!

    I would love to see what creative uses you guys have used this for, if any of you feel like sharing.
    Non-RS scripter, if you need a hand with scripting let me know. I have a decent amount of experience scripting for non-RS games.

    How to add text messaging to any script: http://villavu.com/forum/showthread....98#post1151998

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •