Jump to content



Photo

Run Ubot Software on iPhones - Step By Step Tutorial


  • Please log in to reply
51 replies to this topic

#1 Kev

Kev

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 636 posts
  • OS:Windows 8
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 25 October 2013 - 04:12 AM

How to run software from an iPhone

 

Ok folks, this is a complete walkthrough on how I set up my software so as people can run their services on their mobile devices whilst the bots run on my VPS or local pc and running 24/7. The end user, or customer, can access the software via a web form integration from their smart phone or any web browser that feeds the data into a MySQL database which the software will read the data from.

Things I use:

 

A jotform account (http://www.jotform.com and you can get a free account - not an affiliate link). Please note, I bought a jotform package on a "Black Friday" deal last year and it cost $69.50 for two years for the professional package.

PhpMysql (typically found with any half decent hosting plan. I use liquidweb, amongst others for my database and hosting needs.

Here’s the VPS I currently use: http://www.liquidweb.com/managed-vps-hosting/

My local box has 8GB ram and 3GHz processor. Not a big techie when it comes to hardware specs to be honest.

So with the hardware out of the way here’s what I’m going to cover in this tutorial:

How to set up the form and create the database

How I connect and read my data from the form

How to set up the bots to run 24/7

How I handle memory issues

How to set up the form and create the database

Once you’ve set up your jotform account you will need to submit your form to a specific url. This url will tell you what the form looks like in a fashion that will allow you to set up your database. You’ll only ever need to do this one time for each form you want to integrate with your software.

Create a new text file. Inside the text file paste the following code:

<?php
    print_r($_POST);
?>

Now, save that text file and then close it out. Now, rename the file to postdetails.php

Make sure to rename the file extension!

Upload this php file somewhere on your server. I suggest creating a new folder on your linux hosting and drop that file into it. Take note of the path. The url I use (for your reference) is http://eirtime.com/jfsub/postdetails.php

Ok, now go create your web form.

For this example let’s just create two fields: your name and your email address. Go do that inside jotform now.

Once you’ve created your form go to: Preferences > Advanced Settings > Send Post Data - YES

Click Close Settings.

Click on the Thank You button at the top. Select Custom URL. In there place the URL to your postdetails.php file.

Now preview your form and submit your data.

You should see something very similar to this on the thank you page:

Array ( [submission_id] => 248504684902184300 [formID] => 32973029077864 [ip] => 123.456.789.123 [name] => Kevin [email] => myemail@gmail.com ) 

Things to note here (and useful for when programming your software) - the submission_id will ALWAYS be unique. You will never see that number again. It can therefore be used as a “Case number” for when someone submits data. e.g. “Thanks for your submission. Your unique reference number is SUBMISSION_ID”.

Ok, so take note of all the names of the array contents (basically ANYTHING inside the square brackets.

In the form example above we would take note of:

submission_id
formID
ip
name
email

Now, you’ll need to create a new database inside youe cpanel account. Create a new database, add your user and give the user all privileges and then launch your phpmyadmin

In there you’ll need to create a new table. Call the table whatever you like, but take note of the table name. Once you do this it will ask you how many columns you want. In our example we want 5. Call each column by the corresponding names above and select VARCHAR and add 1000 to the value (that is if you don’t know what you’re doing).

I’m rushing over the database set up as it’s pretty straight forward, particularly when using the DB creation wizard from within Cpanel. Please ensure to take note of usernames and passwords for the user and database name.

Inside cpanel there’s an option for Remote Database connections - you’ll need to add a wild card option there as your bots will be remotely connecting. So, look for that inside your cpanel account. Also, take note of your IP number of your server.

Some users may experience difficulty with shared accounts here and shared IPs. I have no experience in this as I have a dedicated IP ($1 per month).

Ok so that’s the first step.

Next what we need to do is edit a php file. This is going to take a bit of time to do and quite detailed, however it’s NOT difficult, as long as you edit the right things and delete what’s not needed.

Copy and paste this code into a new text file

<?php
function ExtendedAddslash(&$params)
{
       foreach ($params as &$var) {
           // check if $var is an array. If yes, it will start another ExtendedAddslash() function to loop to each key inside.
           is_array($var) ? ExtendedAddslash($var) : $var=addslashes($var);
           unset($var);
       }
}
// Initialize ExtendedAddslash() function for every $_POST variable
ExtendedAddslash($_POST);  
  
$submission_id = $_POST['submission_id'];
$formID = $_POST['formID'];
$ip = $_POST['ip'];
$name = $_POST['name'];
$email = $_POST['email'];


$db_host = 'localhost';
$db_username = 'changeme';
$db_password = 'changeme';
$db_name = 'changeme';
mysql_connect( $db_host, $db_username, $db_password) or die(mysql_error());
mysql_select_db($db_name);
// search submission ID
$query = "SELECT * FROM `changeme` WHERE `submission_id` = '$submission_id'";
$sqlsearch = mysql_query($query);
$resultcount = mysql_numrows($sqlsearch);
if ($resultcount > 0) {

    mysql_query("UPDATE `changeme` SET
                               `submission_id` = '$submission_id',
                               `formID` = '$formID',
                               `ip` = '$ip',
                               `name` = '$name',
                               `email` = '$email',
                               
                                                                                               
      
                            WHERE `submission_id` = '$submission_id'")
    or die(mysql_error());
  
} else {
    mysql_query("INSERT INTO `changeme` (submission_id, formID, IP, name, email)
                              VALUES ('$submission_id', '$formID', '$ip', '$name', '$email') ")
    or die(mysql_error());
}
  header( 'Location: http://google.com' ) ;
?>

If you always leave submission_id, formID, IP as they are, you’ll only ever need to change name, email and add any other [array details] to this form. Ensure to add the database connection details to the form above!

However, the above form is ready to run when taking into account the information I used from the initial form submission.

So, save that file as testsubmission.php and upload it again like the last time, to your server. Take note of the URL.

Go back to your form and edit the thank you page - change the custom URL to your new URL.

Submit your form and if all works well it should direct you to Google.com

If it doesnt it will tell you where the error is.

The above information will take you the most time to figure out, particularly if you are new to all this. However, once you master it it’s a great way to integrate a form with a database, which we then integrate with our ubot code!

How I connect and read my data from the form

 

As long as you’ve got redirected to Google.com you’ve got nearly everything set up and ready to now start integrating your ubot code to your database!

 

2013-10-25_1129.png

 

Take a look at the above image.

What you will notice is the query with results part has tablename written there. You will need to replace that with whatever you added as your table name when you set up your database.

 

Why did I use LIMIT 1?

 

Well, firstly what it’s doing there is selecting all the data from the tablename form and only the first row. What I do is operate a first row action policy. Whatever information is in the first row gets processed by my software, then that first row gets deleted, moving the row below it up to the top row.

This constant rule of checking JUST the first row allows that if there are multiple submits, only the first row is processed and deleted and then moves onto the next row.

You will need to edit your SQL query to suit what you need to do, however, you won’t need to learn SQL - there’s plenty of “delete first row in database” tutorials on the web, if you need them.

So, once the information from row 1 is added into the &results table, I can then do what I like with the data. Remember, Rows 0,1 and 2 are going to be submission_id, FormID and IP. The other rows are going to be the user inputted data.

How to set up the bots to run 24/7

This took me a while to get fine tuned, but it works now and works well.

I have a Loop While command. EVERYTHING to do with the database and the processing of the results is sitting inside the Loop While. The Loop While is set to a condition that is set when the software is first ran: Set a variable to $true - loop while variable is $true

So, it will continue to loop infinitely as the variable is $true.

Every 15 seconds my bots check the database for any new data. If data appears in the database then it will process it and then add an increment. If there is NO data in the database it obviously doesnt process anything and adds an increment.

I have the increment count up to 100 so I have the bot run in total, 100 times and then it will Shell out to a batch file.

But Kev, you said this bot would run 24/7? Tehcnically this bot in this set up will run 100 times and then a shell script runs and launches a batch file. However, at that moment in time the software isn’t doing anything. So, I say to myself “I want a fresh instance of the bot”. After the shell command to the batch file, I have a Stop Script.

How I handle memory issues

The reason why I had the 100 loop and then shell to a batch file was because I kept running out of memory. The way I worked around this was simple. To shell out to a batchfile that contained the command to START that very same bot again, with an /auto command!

So, as soon as that batch file executed, the original bot came to Stop Script node and simply closed out, meaning I only ever had ONE window of that bot open at any one time. This does mean though that you’ll need to START the initial bot from running the batch file.

Here’s a sample of a batch file command:

"C:\Users\Administrator\Desktop\botname.exe" /auto

(including the quotes)

So, I call that batchfile batch.bat and inside my ubot I use the Shell command and navigate to botname.bat

When that shell command is executed it will run that batch file, which will AUTO start the bot called botname.exe

Since implementing this method I’ve never had memory issues with my software and it runs 24/7.

Things to note

I’ve taken a very simplistic overview of how this whole process works, however, I wanted to ensure that you got the bulk of the technical details at the start to ensure you get the web form integration right. The rest of the information provided is complete however not as detailed. This is simply because you’ll want to make your software do your own things. You might want to schedule it to run on the hour every hour, or once a day, NOT 24/7 like I have.

You may also discover coding bugs along the way. For instance I can tell you that sometimes running a 24/7 bot where the website you’re navigating to may be down. What happens to your bot then? How will you know there’s a problem? You’ll need to discover these things yourself.

I can tell you though that implementing a similar integration to what I’ve outlined above WILL allow you to run your software as a servive. I use this model as often as I can and hardly ever indicate to a client that they can have a desktop application. I’m pushing for a monthly revenue stream as often as possible and this integration allows me that flexibilty. I can also tell you that once you integrate using a web form you are essentially taking away the need to run software on a desktop PC and now your customers can run the service from their iPhones, iPads or god forbid, even a Mac!

 

About Me

I’m NOT a programmer. I’m a marketer. I make products and sell them to other marketers and to local businesses. I’ve been using ubot for about 2 years and can tell you that once I started using the SaaS model in my business I was able to increase my monthly revenue and close more sales simply because I could run demonstrations from my iPad, the client’s iPad or Smart phone, whatever! I didn’t need to lug a laptop with me, or rely on an internet connection. Also, I didn't want to give away the software tools - I wanted to hold onto them, having total control yet giving the customer what they needed. If they don’t pay, I simply disable their web form!

Don’t Give Up!

If you’re new to ubot stick at it! So many buy it and don’t do anything with it then find fault with ubot. Ubot does exactly what I need it to do. If it doesn't do what you need FIND ANOTHER WAY inside ubot! People assumed bots can only be ran on Windows PCs. Well, I’ve just outlined a detailed plan to get bots running on any device. You just need to come up with the ideas!

Ask questions. Learn from other questions posted. Try contribute to other people’s questions and all the while develop on what you know - making things run better and better each time.

 

 

 

Here's a screenshot I just took from inside my jotform account with three forms belonging to the same project. Check the volume of submits for them and the software handles everything flawlessly.

 

submits.png

 

Try out a real working form!

Click on the image below

2013-10-27_1044.png

 

 

I hope you got some value out of this tutorial. I enjoyed putting it together and if you have any questions please ask.


Sell Software tools? Then You Need Us

 

 


#2 rocket976

rocket976

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 575 posts
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v4.0
  • License:Developer Edition

Posted 25 October 2013 - 06:54 AM

AWESOME and exactly whats been on my mind lately! Thank you very much for sharing Kev



#3 Kev

Kev

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 636 posts
  • OS:Windows 8
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 25 October 2013 - 07:26 AM

AWESOME and exactly whats been on my mind lately! Thank you very much for sharing Kev

Cheers Rich,

 

Took far longer to write it out than I'd thought, but it's there now for everyone.


Sell Software tools? Then You Need Us

 

 


#4 jason

jason

    Advanced Member

  • ADMIN
  • 615 posts
  • LocationBay Area
  • OS:Windows 8
  • Total Memory:2Gb
  • Framework:v4.0
  • License:Developer Edition

Posted 25 October 2013 - 09:11 AM

Thanks Kev. Awesome.



#5 kev123

kev123

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 739 posts
  • OS:Windows 8
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 25 October 2013 - 09:22 AM

really good contribution thankyou



#6 Kreatus (Ubot Ninja)

Kreatus (Ubot Ninja)

    Custombotsolutions.com

  • Fellow UBotter
  • PipPipPip
  • 3202 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 25 October 2013 - 10:33 AM

Thanks. This should be handy in the future..



#7 wilriv21

wilriv21

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 78 posts
  • LocationLos Angeles
  • OS:Windows 8
  • Total Memory:8Gb
  • Framework:v4.0
  • License:Developer Edition

Posted 25 October 2013 - 12:35 PM

Kev,

 

Thank you very much for taking time to share this with the community.  It is greatly appreciated.

 

Regards,

William



#8 Kev

Kev

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 636 posts
  • OS:Windows 8
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 25 October 2013 - 02:58 PM

Thanks Kev. Awesome.

  

really good contribution thankyou

  

Thanks. This should be handy in the future..

  

Kev,
 
Thank you very much for taking time to share this with the community.  It is greatly appreciated.
 
Regards,
William


My pleasure. I hope it's useful to many.

Sell Software tools? Then You Need Us

 

 


#9 Babba

Babba

    Member

  • Members
  • PipPip
  • 14 posts
  • OS:Windows 8
  • Total Memory:6Gb
  • Framework:v4.0
  • License:Professional Edition

Posted 25 October 2013 - 03:15 PM

Thanks for sharing this! It´s the future ;)



#10 Steve

Steve

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 262 posts
  • OS:Windows 8
  • Total Memory:More Than 9Gb
  • Framework:v4.0
  • License:Developer Edition

Posted 25 October 2013 - 03:25 PM

Awesome share! Very detailed! Will be using this down the road..



#11 Kev

Kev

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 636 posts
  • OS:Windows 8
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 26 October 2013 - 04:56 AM

Thanks for sharing this! It´s the future ;)

 

 

Awesome share! Very detailed! Will be using this down the road..

You're welcome :)


Sell Software tools? Then You Need Us

 

 


#12 illmill

illmill

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 458 posts
  • OS:Windows 8
  • Total Memory:8Gb
  • Framework:v3.5
  • License:Developer Edition

Posted 26 October 2013 - 08:34 PM

Wow, this is amazing, Kev!  Good one, thanks for the detailed info.  I've bookmarked this and will be referring back when I move my bots over to this model.



#13 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1560 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 26 October 2013 - 08:42 PM

That is so awesome, been wondering if you were gonna share or sell....now we all know.

 

We can all benefit from this it's sooo one of the best shares here at UBot forum.

 

Thanks buddy and I hope others are inspired like myself to share things as awesome as this!!

 

TC


UBot Expert Tutorials Store

 

 

Python and UBot expert tutorials and documentation


#14 don

don

    Member

  • Members
  • PipPip
  • 26 posts
  • OS:Windows 8
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 26 October 2013 - 09:04 PM

Great share Kev, would be using it near future (Y)



#15 wtf

wtf

    Member

  • Fellow UBotter
  • PipPip
  • 26 posts
  • LocationUK
  • OS:Windows 7
  • Total Memory:6Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 26 October 2013 - 11:35 PM

This is very cool, huge thanks for sharing that Kev.



#16 Kreatus (Ubot Ninja)

Kreatus (Ubot Ninja)

    Custombotsolutions.com

  • Fellow UBotter
  • PipPipPip
  • 3202 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 27 October 2013 - 03:30 AM

Hi Kev,

 

Just one question, does it have to be one bot per customer?

I mean, if the customer submit a form and then it should run the bot for him/her. What if 10 other more do that at the same time?

What is your take on this!

 

Thanks again for sharing this stuff! This is a gem!



#17 Kev

Kev

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 636 posts
  • OS:Windows 8
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 27 October 2013 - 03:32 AM

Hi Kev,

 

Just one question, does it have to be one bot per customer?

I mean, if the customer submit a form and then it should run the bot for him/her. What if 10 other more do that?

What is your take on this!

 

Thanks again for sharing this stuff! This is a gem!

Hey man,

 

No ,not at all!

 

I have one bot, ran in this same fashion, with over 2000 customers all using it. On the launch day I had the same bot running twice just to help with volume and tell folks there may be a slight delay due to volumes (said on the thank you page after submission) but really, I just use one now as the work flow has died down somewhat.

 

So, one bot, lots of customers, one task done at a time. This works well as the tasks dont take long to complete anyway.


Sell Software tools? Then You Need Us

 

 


#18 Kev

Kev

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 636 posts
  • OS:Windows 8
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 27 October 2013 - 03:47 AM

Bump: folks I've just added a form to the bottom of the thread for you to see it working in real time. Ensure to enter the data correctly (email address) so as you receive the output in your inbox.

 

Typically takes 30-60 seconds. Notice I have the redirect coming back to this page. If it were a membership site it could go there (which it does).

 

Enjoy!


Sell Software tools? Then You Need Us

 

 


#19 Sirfrank

Sirfrank

    Advanced Member

  • Members
  • PipPipPip
  • 109 posts
  • OS:Windows 8
  • Total Memory:8Gb
  • Framework:v4.0
  • License:Developer Edition

Posted 14 November 2013 - 05:59 PM

Holy crap MAN, i am using all these mentioned resources ( jotform, etc) and also think i am much of a "think outside of the box" guy, but this one.....

 

DROPPED MY JAW!

 

Excellent!!!


Edited by Sirfrank, 14 November 2013 - 05:59 PM.


#20 Kev

Kev

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 636 posts
  • OS:Windows 8
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 15 November 2013 - 12:15 PM

Holy crap MAN, i am using all these mentioned resources ( jotform, etc) and also think i am much of a "think outside of the box" guy, but this one.....

 

DROPPED MY JAW!

 

Excellent!!!

 

 

I'm just joining the dots, that is all :)


Sell Software tools? Then You Need Us

 

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users