update

update(); - forcibly update the proxy list. When updating, the proxy is added from the url and the update file. Then duplicates are deleted. And reset the current proxy position to the beginning of the file.

After testing, the function returns the result of its work to the script :
  • true – successfully updated
  • false – failed to update

    PHP example: webpage->".basename(__FILE__)."
    "; //1 echo "1.Let's create a file with a proxy:"; $path = "test/add_proxies.urls"; echo $file_os->delete($path).""; echo $textfile->add_string_to_file($path, "222.124.22.133:8080 ").""; echo $textfile->add_string_to_file($path, "47.90.72.227:8088 ").""; //2 echo " n2.Initialize proxy switch in folder:"; echo $proxyswitcher->init("Proxy Switcher")." n"; //3 echo "3.Let's read everything that was there to iterate over from the beginning:"; echo $proxyswitcher->clear()." n"; //4 echo "4.Add proxy from file:"; echo $proxyswitcher->add_proxies_from_file($path)." n"; //4.5 echo "4.5 Add proxy:"; echo $proxyswitcher->add_proxies("125.212.207.121:3128 ")." n"; //five echo "5.Add proxy from url:"; echo $proxyswitcher->add_proxies_from_url("http://humanemulator.net/poligon/add_proxies.html")." n"; //6 echo "6.Let's set the update parameters:"; echo $proxyswitcher->set_update_path($path).""; echo $proxyswitcher->set_update_url("http://humanemulator.net/poligon/add_proxies.html").""; echo $proxyswitcher->set_update_period(100).""; echo $proxyswitcher->set_update_proxy_count(0)." n"; //6.5 echo "6.5.Let's set the sequential search mode:"; echo $proxyswitcher->set_random_rotate_mode(false)." n"; //7 $browser->set_wait_params(120,1); echo "7.Let's iterate over the proxy: n n"; while(true) { $proxy = $proxyswitcher->get_next_proxy(); if($proxy == "") break; echo $proxy; //$browser->enable_proxy("", $proxy); //if($browser->navigate("whoer.net")) //echo "worker"; //else //echo "rotten"; // echo " n"; } //8 echo " n8.Get all contents of the proxy switch: n n"; echo $proxyswitcher->get_all_proxies()." n"; //nine echo " n9.Get the number of proxies:"; echo $proxyswitcher->get_proxy_count()." n"; //ten $browser->set_wait_params(120,1); echo "10.Let's iterate over the proxy(with removal): n n"; while(true) { $proxy = $proxyswitcher->get_next_proxy(true); if($proxy == "") break; echo $proxy."left:".$proxyswitcher->get_proxy_count().""; if($proxyswitcher->get_proxy_count() == 0) break; //$browser->enable_proxy("", $proxy); //if($browser->navigate("whoer.net")) //echo "worker n"; //else //echo "rotten n"; // echo " n"; } //eleven echo " n n11.Let's set the random search mode:"; echo $proxyswitcher->set_random_rotate_mode(true)." n"; //12 echo "12.Update:"; echo $proxyswitcher->update(true)." n"; //thirteen $browser->set_wait_params(120,1); echo "13.Let's iterate over the proxy(accidentally with deletion): n n"; while(true) { $proxy = $proxyswitcher->get_next_proxy(true); if($proxy == "") break; echo $proxy."left:".$proxyswitcher->get_proxy_count().""; if($proxyswitcher->get_proxy_count() == 0) break; //$browser->enable_proxy("", $proxy); //if($browser->navigate("whoer.net")) //echo "worker n"; //else //echo "rotten n"; echo " n"; } //end echo "

    "; //Quit $app->quit(); ?>
    Python example: # Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7016" from xweb_human_emulator import * # Start echo("
    proxycheker.xxxxxxxxx
    ") # 1 echo("1.Let's create a file with a proxy:"); path = "test/add_proxies.urls"; echo(file_os.delete(path), ""); echo(textfile.add_string_to_file(path, "222.124.22.133:8080 ")," "); echo(textfile.add_string_to_file(path, "47.90.72.227:8088 ")," "); # 2 echo(" 2.We initialize the proxy switch in the folder: "); echo(proxyswitcher.init("Proxy Switcher"), " "); # 3 echo("3.Let's read everything that was there to iterate over from the beginning:"); echo(proxyswitcher.clear(), " "); # 4 echo("4.Add proxy from file:"); echo(proxyswitcher.add_proxies_from_file(path), " "); # 4.5 echo("4.5 Add proxy:"); echo(proxyswitcher.add_proxies("125.212.207.121:3128 ")," "); # five echo("5.Add proxy from url:"); echo(proxyswitcher.add_proxies_from_url("http://humanemulator.net/poligon/add_proxies.html"), " "); # 6 echo("6.Let's set the update parameters:"); echo(proxyswitcher.set_update_path(path), ""); echo(proxyswitcher.set_update_url("http://humanemulator.net/poligon/add_proxies.html"), ""); echo(proxyswitcher.set_update_period(100), ""); echo(proxyswitcher.set_update_proxy_count(0), " "); # 6.5 echo("6.5.Let's set the sequential search mode:"); echo(proxyswitcher.set_random_rotate_mode(false), " "); # 7 browser.set_wait_params(120,1); echo("7.Let's iterate over the proxy: "); while(true): proxy = proxyswitcher.get_next_proxy(); if proxy == "": break; echo(proxy); echo(" "); # 8 echo(" 8.Get all the contents of the proxy switch: "); echo(proxyswitcher.get_all_proxies(), " "); # nine echo(" 9.Get the number of proxies: "); echo(proxyswitcher.get_proxy_count(), " "); # ten browser.set_wait_params(120,1); echo("10.Let's iterate over the proxy(with removal): "); while(true): proxy = proxyswitcher.get_next_proxy(true); if proxy == "": break; echo(proxy + "left:" + proxyswitcher.get_proxy_count() + ""); if proxyswitcher.get_proxy_count() == 0: break; echo(" "); # eleven echo(" 11.Let's set a random search mode: "); echo(proxyswitcher.set_random_rotate_mode(true), " "); # 12 echo("12.Update:"); echo(proxyswitcher.update(), " "); # thirteen browser.set_wait_params(120,1); echo("13.Let's iterate over the proxy(accidentally with deletion): "); while(true): proxy = proxyswitcher.get_next_proxy(true); if proxy == "": break; echo(proxy + "left:" + proxyswitcher.get_proxy_count(), ""); if proxyswitcher.get_proxy_count() == 0: break; echo(" "); # end echo("

    ") # Quit app.quit()
    C# example: #region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; #endregion class Program: XHEScript { static void Main(string [] args) { //init XHE server = "127.0.0.1:7016"; InitXHE(); //Start echo("
    ftp.command
    "); //1 echo("1.Let's create a file with a proxy:"); var path = "test/add_proxies.urls"; echo(file_os.delete(path) + ""); echo(textfile.add_string_to_file(path, "222.124.22.133:8080 ") + ""); echo(textfile.add_string_to_file(path, "47.90.72.227:8088 ") + ""); //2 echo(" n2.Initialize proxy switch in folder:"); echo(proxyswitcher.init("Proxy Switcher") + " n"); //3 echo("3.Let's read everything that was there to iterate over from the beginning:"); echo(proxyswitcher.clear() + " n"); //4 echo("4.Add proxy from file:"); echo(proxyswitcher.add_proxies_from_file(path) + " n"); //4.5 echo("4.5 Add proxy:"); echo(proxyswitcher.add_proxies("125.212.207.121:3128 ") + " n"); //five echo("5.Add proxy from url:"); echo(proxyswitcher.add_proxies_from_url("http://humanemulator.net/poligon/add_proxies.html") + " n"); //6 echo("6.Let's set the update parameters:"); echo(proxyswitcher.set_update_path(path) + ""); echo(proxyswitcher.set_update_url("http://humanemulator.net/poligon/add_proxies.html") + ""); echo(proxyswitcher.set_update_period(100) + ""); echo(proxyswitcher.set_update_proxy_count(0) + " n"); //6.5 echo("6.5.Let's set the sequential search mode:"); echo(proxyswitcher.set_random_rotate_mode(false) + " n"); //7 browser.set_wait_params(120,1); echo("7.Let's iterate over the proxy: n n"); while(true) { var proxy = proxyswitcher.get_next_proxy(); if(proxy == "") break; echo(proxy); echo(" n"); } //8 echo(" n8.Get all the contents of the proxy switch: n n"); echo(proxyswitcher.get_all_proxies() + " n"); //nine echo(" n9.Get the number of proxies:"); echo(proxyswitcher.get_proxy_count() + " n"); //9.5 echo("12.Update:"); echo(proxyswitcher.update() + " n"); //ten browser.set_wait_params(120,1); echo("10.Let's iterate over the proxy(with removal): n n"); while(true) { var proxy = proxyswitcher.get_next_proxy(true); if(proxy == "" || proxy == "false") break; echo(proxy + "left:" + proxyswitcher.get_proxy_count() + ""); if(proxyswitcher.get_proxy_count() == 0) break; echo(" n"); } //eleven echo(" n n11.Let's set the random search mode:"); echo(proxyswitcher.set_random_rotate_mode(true) + " n"); //12 echo("12.Update:"); echo(proxyswitcher.update() + " n"); //thirteen browser.set_wait_params(120,1); echo("13.Let's iterate over the proxy(accidentally with deletion): n n"); while(true) { var proxy = proxyswitcher.get_next_proxy(true); if(proxy == "" || proxy == "false") break; echo(proxy + "left:" + proxyswitcher.get_proxy_count() + ""); if(proxyswitcher.get_proxy_count() == 0) break; echo(" n"); } //end echo("

    "); app.quit(); } }
    Java Script example: //connect the object to control the emulator, if not already connected xhe_host = "127.0.0.1:7016"; echo = require("../../../Templates JS/xweb_human_emulator.js"); //Start echo("
    proxyswitcher.init
    "); //1 echo("1.Let's create a file with a proxy:"); var path = "test/add_proxies.urls"; echo(file_os.delete(path) + ""); echo(textfile.add_string_to_file(path, "222.124.22.133:8080 ") +" "); echo(textfile.add_string_to_file(path, "47.90.72.227:8088 ") +" "); //2 echo(" 2.We initialize the proxy switch in the folder: "); echo(proxyswitcher.init("Proxy Switcher") + " "); //3 echo("3.Let's read everything that was there to iterate over from the beginning:"); echo(proxyswitcher.clear() + " "); //4 echo("4.Add proxy from file:"); echo(proxyswitcher.add_proxies_from_file(path) + " "); //4.5 echo("4.5 Add proxy:"); echo(proxyswitcher.add_proxies("125.212.207.121:3128 ") +" "); //five echo("5.Add proxy from url:"); echo(proxyswitcher.add_proxies_from_url("http://humanemulator.net/poligon/add_proxies.html") + " "); //6 echo("6.Let's set the update parameters:"); echo(proxyswitcher.set_update_path(path) + ""); echo(proxyswitcher.set_update_url("http://humanemulator.net/poligon/add_proxies.html") + ""); echo(proxyswitcher.set_update_period(100) + ""); echo(proxyswitcher.set_update_proxy_count(0) + " "); //6.5 echo("6.5.Let's set the sequential search mode:"); echo(proxyswitcher.set_random_rotate_mode(false) + " "); //7 browser.set_wait_params(120,1); echo("7.Let's iterate over the proxy: "); while(true) { var proxy = proxyswitcher.get_next_proxy(); if(proxy == "") break; echo(proxy); echo(" "); } //8 echo(" 8.Get all the contents of the proxy switch: "); echo(proxyswitcher.get_all_proxies() + " "); //nine echo(" 9.Get the number of proxies: "); echo(proxyswitcher.get_proxy_count() + " "); //ten browser.set_wait_params(120,1); echo("10.Let's iterate over the proxy(with removal): "); while(true) { var proxy = proxyswitcher.get_next_proxy(true); if(proxy == "") break; echo(proxy + "left:" + proxyswitcher.get_proxy_count() + ""); if(proxyswitcher.get_proxy_count() == 0) break; echo(" "); } //eleven echo(" 11.Let's set a random search mode: "); echo(proxyswitcher.set_random_rotate_mode(true) + " "); //12 echo("12.Update:"); echo(proxyswitcher.update(true) + " "); //thirteen browser.set_wait_params(120,1); echo("13.Let's iterate over the proxy(accidentally with deletion): "); while(true) { var proxy = proxyswitcher.get_next_proxy(true); if(proxy == "") break; echo(proxy + "left:" + proxyswitcher.get_proxy_count() + ""); if(proxyswitcher.get_proxy_count() == 0) break; echo(" "); } //end echo("

    "); //Quit app.quit();