Friday, November 27, 2009

Script for twitter.com regstration.

It is a simple script-regestrator for Twitter.com.The script automatically fill data fields and shows a dialog input captcha. If you have access to whatever service recognition CAPTCHA, then this service can be connected to this script.

PHP code:

?php
// The following code is required to properly run Web Human Emulator
require("../Templates/xweb_human_emulator.php");

//////////////////////// settings for scripts
// name
$usr_name ="name";
// login
$usr_login = "login";
// password
$usr_pwd = "password";
// mail
$usr_mail = "mail";
// message
$usr_message = "message";
//////////////////////////////////////////////////////////
// go to twitter
$browser->navigate('twitter.com');
$browser->wait_for(240,1);

// go to registration
$anchor->click_by_inner_text('Sign up now','true');
$browser->wait_for(240,1);
// set name
$input->set_value_by_name('user[name]',$usr_name);
// set login
$input->set_value_by_name('user[screen_name]',$usr_login);
// set password
$input->set_value_by_name('user[user_password]',$usr_pwd);
// set mail
$input->set_value_by_name('user[email]',$usr_mail);

////////////////////////////////////// recognize recatcha

$pref ="src=\"https://api-secure.recaptcha.net/image?c=";
$pref1 ="\" width=";
$text = $webpage->get_body();

$ind = strpos($text,$pref);
$ind1 = strpos($text,$pref1,$ind);

$cod = substr($text,$ind+strlen($pref),$ind1-$ind-strlen($pref));

$url_captcha = "https://api-secure.recaptcha.net/image?c=".$cod;

$captcha = $app->dlg_captcha_from_url_exactly($url_captcha,"false");
// set captcha
$input->set_value_by_name("recaptcha_response_field",$captcha);

//////////////////////////////////////////////////////////////////////////////////////

// register
$button->click_by_name('commit');
$browser->wait_for(240,1);
// skip next step
$anchor->click_by_inner_text('Skip this step','true');
$browser->wait_for(240,1);
// apply all
$button->click_by_name('commit');
$browser->wait_for(240,1);
// set message
$textarea->set_value_by_name('status',$usr_message);
// update message on twitter
$button->click_by_name('update');
$browser->wait_for(240,1);

// Quit
$app->quit();
?>

Thursday, November 26, 2009

Working with files and organization of the loop in Web Human Emulator.

Often we need to read data from a file and setting of the cycle in a field. Write a simple script that will say read from the file search requests entered into Google search box and click on the search button.

First, we'll create a script using the File menu, click New Menu. In the editor php-stream program will open a new tab with the following code:

? php
// The following code is required to properly run XWeb Human Emulator
require ("../Templates/xweb_human_emulator.php ");

// Navigate to google
$browser->navigate("http://www.google.com");
// Wait on browser
$browser->wait(1);

// Quit
$app->quit();
?>

If you run this script, then the browser program will open Google.

Now the mouse cursor is over in the search box, we click the right mouse button and see the popup menu.
One of the items is $input leads to another menu, it separates the functions for the object $input. Click on the $input->set_value_by_name("q ",""); menu and this string appears in the php editor. Do the same with the "Search Google" button. Context menu $button and drop-down menu choose $button->click_by_name("btnG");. This line is added to the editor in the script.

Note: before inserting thus function, place the cursor at the location where you want the script to insert the otherwise it will be inserted where there is currently the cursor!

Immediately after the function $button->click_by_name("btnG"); add $browser->wait(1);. This function is mandatory after every function of transition or upgrade your browser. She expects until the browser will perform specified actions, and then executes the script further.

Now the script looks as follows:

? php
// The following code is required to properly run XWeb Human Emulator
require ("../ Templates / xweb_human_emulator.php ");

// Navigate to google
$browser->navigate("http://www.google.com");
// Wait on browser
$browser-> wait (1);

$input->set_value_by_name ( "q ","");

$button->click_by_name ( "btnG");
$browser->wait (1);

// Quit
$app->quit();
?>

When executed, this script is an empty string is entered in the search box and clicks the Search button.

Now connect queries from a file and will introduce them in the search box in the cycle.

For this first prochiatem file into an array with the following code:

$arr_search = file("c:\\search_string.txt")

If the file is asking for is in the same folder as the script then absolutely path may be omitted and the code is as follows:

$arr_search = file("search_string.txt")

Function PHP file reads each line of the file in a separate element of the array.

Now organize a cycle based on the number of elements in the array, ie kolichesvto lines read from the file:

loop - for($i = 0; $i < ($arr_search); $i++)
loop body - ()

that would get the current element masciva must add this code that's $arr_search[$ i]

eventually have the following code:

? php
// The following code is required to properly run XWeb Human Emulator
require ("../ Templates / xweb_human_emulator.php ");

// Read data from a file into an array
$arr_search = file ( "search_string.txt")

// Organize the script
for ($i = 0; $i < ($arr_search); $i++)
{
// Navigate to google
$browser->navigate("http://www.google.com");
// Wait on browser
$browser->wait(1);

// Print request to the debug window
echo $arr_search[$i]. "br>";

// Enters a query into the search box
$input->set_value_by_name("q", $ arr_search [$ i]);

// Push the search button
$button->click_by_name ( "btnG");
$browser->wait(1);

// Look at the results of 5 seconds:)
sleep (5);

// ... here you can continue to do anything with the results of search to gather them in a file
// Go to each site and parse the text in the file, etc.
}
// Quit
$app->quit();
?>

When you run the script to execute script reads all rows from the file search_string.txt set into the search field and clicks on the Search button, after waits 5 seconds and moves on.

Wednesday, November 25, 2009

Script for search data through Google. Part1.

With Web Human Emulator you can find and collect various information using the search engine Google.

Let's write a script.

First of all you create a new script using the menu New. The result is the following code:



Then we run the script is executed using the Run button or hot key F5. After running the script in the browser will open Google:



Set the cursor in the php editor to line 9 and then select the Google search box. After, click on the field right mouse button and result we get context menu:



Push the menu $input, and we see the menu with functions for this object.



We click on the $input->set_value_by_name("q ",""); menu item and this line appears in the PHP editor and we have next code in the PHP editor:



Add a search word or phrase in the function $input->set_value_by_name("q ",""); and have for example $input->set_value_by_name("q","car for sale");. Run script for execution and eventually have such a result.



After we click the right mouse button on the button "Search in Google" and see the popup menu.



Roll over $button and see a drop-down menu with the object $button functions. Click on $button->click_by_name("btnG");. This line appears in the PHP editor. Copy string $browser->wait(1); and paste it after $button->click_by_name("btnG"); In result we have follow code:


Run the script and we have next result:



Thus we have the first part of the script - search for a specific query in Google and receive search results. Now we need to write a second part to find needed information and parsing it in the needed format. To be continued ...

Tuesday, November 24, 2009

Script for register you web site to 3 Search Engines

I wrote script for register my site to 3 Seach Engines - MSN(Bing),Google and Yahoo.

PHP code:

// The following code is required to properly run Web Human Emulator
require("../../Templates/xweb_human_emulator.php");

// This script submit your site to 3 Search Engines
// Google
// MSN
// Yahoo
// for request more SE please write to humanemulator@gmail.com

// ======================= COMMON INFO =================
$title="title";
$url="http://www.sitebred.com/";
$comments="comments";
$contact_face="name";
$contact_mail="mal@mail.com";
// ======================================================

// ======================= GOOGLE ======================
// goto to add page
$browser->navigate("http://www.google.com/addurl/?continue=/addurl");
$browser->wait(1);
// add reg info
$input->set_value_by_number(1,$url);
$input->set_value_by_number(2,$title);
$captcha=$app->dlg_captcha_from_image_number(7);
$input->set_value_by_name("captcha",$captcha);
$button->click_by_number(1);
$browser->wait(1);
// ======================================================

// ======================= MSN ==========================
// goto to add page
$browser->navigate("http://www.bing.com/docs/submit.aspx");
$browser->wait(1);
// add reg info
$input->set_value_by_name("url",$url);
$captcha=$app->dlg_captcha_from_image_number(0);
$input->set_value_by_name("h",$captcha);
$button->click_by_name("submit_url");
$browser->wait(1);
// ======================================================

// ======================= YAHOO ========================
// goto to add page
$browser->navigate("https://siteexplorer.search.yahoo.com/submit");
$browser->wait_for(10,1);

$anchor->click_by_inner_text("Submit a Website or Webpage","true");
$browser->wait_for(10,1);

// add reg info
$input->set_value_by_name("site_url",$url);

$button->click_by_inner_text("Submit URL");
$browser->wait_for(10,1);
// ======================================================

// Quit
$app->quit();


Object Description from this script:

browser - object for work with WHE browser (navigate to website,wait for load web page etc)

input - object for work with INPUT elements of web page (set value, get value etc)

app - object for manage WHE application and captcha dialogs

button - object for work with INPUT (type button) elements of web page (press button, set focus etc)

anchor - object for work with links (A tag)of web page (click. get text etc)

Monday, November 23, 2009

Your first Web Human Emulator script


Open menu File press New and you wrote your first Web Human Emulator Script.

PHP code:
// The following code is required to properly run XWeb Human Emulator
require("../Templates/xweb_human_emulator.php");

// navigate to google
$browser->navigate("http://www.google.com");
// wait on browser
$browser->wait(1);

// Quit
$app->quit();


Script navigate browser to google.com. Press button Run or press F5 and script will executed.

Web Human Emulator installation.

Description of the installation process Web Human Emulator on your computer:
Starts the Setup program WebHumanEmulatorInstall.exe.
Next, performing all the items set installation program on your computer.
Run.
We see the window activation code on a helmet and email sales@webemulator.com. Get the activation code and paste in the field of activation. in the email field insert your email and click activate. Get the message Thank You and the program starts.
Set up once installation - on F9 brings up the dialog settings and prescribes the path to the PHP folder.

What is Web Human Emulator?

Web Human Emulator is a software that automates your actions in the browser using PHP scripts and its objects. Objects WHE have a wide functional to work with various html elements. This functional allows you to automatically fill fields in register and login forms, click on links and buttons, to collect the data from any site, write data to file and much more. Web Human Emulator is a powerful and flexible tool to automate your actions on the Internet.

The program allows you to record all your actions in browser.

The Web Human Emulator can:

Full emulation of human until the mouse movements and keystrokes.
Recognition Captcha - manual and automatic.
Audit site (validity check).
Collect data from any sites.
Submit information in the web - for example: registration of the various catalogs and websites, add posts to the forum, etc.
Emulation of traffic to the site.
Automate tasks on surfing the Internet.
Testing the performance of sites.
Autoposting and Autologin on any forums.
Check for updates of content sites.
Transferring website/blog from one website/blog engine to another.
And much much more ...