set_arrays_count

set_arrays_count($num); - sets the size of the lists of URLs and headers requested by browsers, as well as the lists of URLs received by the browser, redirect URLs, redirect headers, response buffers, and read information. When when tracking the browser's RAW exchange is enabled, everything received and requested by the browser is included in the lists of received and requested information.

the input Function accepts parameters:

  • $num – new list size

    After testing, the function returns the result of its work to the script :
  • true – successfully changed the size of the lists
  • false – failed to change

    PHP example:

    <?php $xhe_host = "127.0.0.1:7028";
     
    //connect the object to control the emulator, if not already connected
    if(!isset($path))
      $path = "../../../Templates/xweb_human_emulator.php";
    require($path);
     
    //Start
    echo "<hr> <font color = blue> raw->".basename(__FILE__)."</font> <hr>";
     
    //1
    echo "1.Turn on RAW tracking:";
    echo $raw->enable_all_streams(true)."<br>";
     
    //2
    echo "2.Let's set the size of the stored query arrays equal to 200:";
    echo $raw->set_arrays_count(200)."<br>";
     
    //3
    echo "3.Let's go to Yandex and Google and msn 1 time:";
    for($i = 0; $i <1; $i ++)
    {
      echo $browser->navigate("http://www.ya.ru");
      echo $browser->navigate("http://www.google.ru");
      echo $browser->navigate("http://www.msn.ru");
    }
     
    //4
    echo "<br> 4.Get the requested urls:";
    $arr_heders = array();
    $arr_redir = array();
    for($i = 0; $i <200; $i ++)
    {
      if($raw->get_last_response_buffer($i) == "false" ||!$raw->get_last_response_buffer($i)) break;
      $arr_heders [$i] ['url'] = $raw->get_last_response_url($i);
      $arr_heders [$i] ['hed'] = $raw->get_last_response_buffer($i);
      $arr_heders [$i] ['urlred'] = $raw->get_last_redirect_url($i);
      $arr_heders [$i] ['hedred'] = $raw->get_last_redirect_header($i);
     
    }
    echo '<br/> <pre>';
    print_r($arr_heders);
    echo '</pre> <br/>';
     
    //turn off tracking
    $raw->enable_all_streams(false);
     
    //end
    echo "<hr> <br>";
     
    //Quit
    $app->quit();
    ?>

    Python example:

    # Additional paths
    import sys
    sys.path.insert(0, '../../../Templates PY/')
     
    xhe_host = "127.0.0.1:7012"
    from xweb_human_emulator import *
     
    # Start
    echo("<hr> <font color = blue> raw.xxxxxxxxx </font> <hr>")
     
    # 1
    echo("1.Turn on RAW tracking:")
    echo(raw.enable_all_streams(true), "<br>")
     
    # 2
    echo("2.Let's set the size of the stored query arrays to 200:")
    echo(raw.set_arrays_count(200), "<br>")
     
    # 3
    echo("3.Let's go to Yandex and Google and msn 10 times:")
    for i in range(0,10):
      echo(browser.navigate("http://www.ya.ru"))
      echo(browser.navigate("http://www.google.ru"))
      echo(browser.navigate("http://www.msn.ru"))
     
    # 4
    echo("<br> 4.Get the requested urls:")
    arr_heders = array()
    arr_redir = array()
    for i in range(0,200):
        if raw.get_last_response_buffer(i) == "false" or not raw.get_last_response_buffer(i):
            break
        arr_heders [i] ['url'] = raw.get_last_response_url(i)
        arr_heders [i] ['hed'] = raw.get_last_response_buffer(i)
        arr_heders [i] ['urlred'] = raw.get_last_redirect_url(i)
        arr_heders [i] ['hedred'] = raw.get_last_redirect_header(i)
     
    echo('<br/> <pre>')
    print(arr_heders)
    echo('</pre> <br/>')
     
    # turn off tracking
    raw.enable_all_streams(false)
     
    # end
    echo("<hr> <br>")
     
    # 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:7010";
    InitXHE();
     
    //Start
    echo("<hr> <font color = blue> raw.set_arrays_count </font> <hr>");
     
    //1 step
    echo("1.Turn on RAW tracking:");
    echo(raw.enable_all_streams(true) + "<br>");
     
    //step 2
    echo("2.Let's set the size of the stored query arrays equal to 100:");
    echo(raw.set_arrays_count(100) + "<br>");
     
    //step 3
    echo("3.Let's go to Yandex and Google and msn 3 times:  n  n");
    for(int i = 0; i <3; i ++)
    {
    echo(browser.navigate("http://www.ya.ru") + "");
    echo(browser.navigate("http://www.google.ru") + "");
    echo(browser.navigate("http://www.msn.ru") + " n");
    }
     
    //step 4
    echo("<br> 4.Get the requested urls:");
    echo("<br/> <pre>");
    for(int i = 0; i <100; i ++)
    {
    if(raw.get_last_response_buffer(i) == "false" || raw.get_last_response_buffer(i) == "false")
    break;
    echo("[" + i.ToString() + "] ['url'] =" + raw.get_last_response_url(i) + " n");
    echo("[" + i.ToString() + "] ['header'] =" + raw.get_last_response_buffer(i) + " n");
    echo("[" + i.ToString() + "] ['url redirected'] =" + raw.get_last_redirect_url(i) + " n");
    echo("[" + i.ToString() + "] ['header redirected'] =" + raw.get_last_redirect_header(i) + " n  n");
    }
    echo("</pre> <br/>");
     
    //turn off tracking
    raw.enable_all_streams(false);
     
    //end
    echo("<hr> <br>");
     
    app.quit();
    }
    }

    Java Script example:

    //connect the object to control the emulator, if not already connected
    xhe_host = "127.0.0.1:7010";
    echo = require("../../../Templates JS/xweb_human_emulator.js");
     
    //Start
    echo("<hr> <font color = blue> raw.set_arrays_count </font> <hr>");
     
    //1 step
    echo("1.Turn on RAW tracking:");
    echo(raw.enable_all_streams(true) + "<br>");
     
    //step 2
    echo("2.Let's set the size of the stored query arrays to 200:");
    echo(raw.set_arrays_count(200) + "<br>");
     
    //step 3
    echo("3.Let's go to Yandex and Google and msn 10 times:");
    for(i = 0; i <10; i ++)
    {
      echo(browser.navigate("http://www.ya.ru");
      echo(browser.navigate("http://www.google.ru");
      echo(browser.navigate("http://www.msn.ru");
    }
     
    //step 4
    echo("<br> 4.Get the requested urls:");
    arr_heders = array();
    arr_redir = array();
    for(i = 0; i <200; i ++)
    {
      if(raw.get_last_response_buffer(i) == "false" ||!raw.get_last_response_buffer(i)) break;
      arr_heders [i] ['url'] = raw.get_last_response_url(i);
      arr_heders [i] ['hed'] = raw.get_last_response_buffer(i);
      arr_heders [i] ['urlred'] = raw.get_last_redirect_url(i);
      arr_heders [i] ['hedred'] = raw.get_last_redirect_header(i);
     
    }
    echo('<br/> <pre>';
    print_r(arr_heders);
    echo('</pre> <br/>';
     
    //turn off tracking
    raw.enable_all_streams(false);
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();