send_post_query

send_post_query($url,$data,$type="application/x-www-form-urlencoded",$set_as_page=false,$add_header=""); - send an HTTP/HTTPS POST request to the specified address

The input function accepts parameters:

  • $url – address of the start page to send the GET request to
  • $data – request data (for example "param1=text" or "param1=text1&param2=text2")
  • $type – request type
  • $set_as_page – set the result as a page in the browser
  • $add_header – an additional string that will be placed in the request header

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

    PHP example: browser->".basename(__FILE__)."
    "; $browser->navigate("ya.ru"); //post pР ° РїСЂРѕСЃ $data = "Nick1 = 111 & Nick2 = 123"; echo $browser->send_post_query("http://httpbin.org/post", $data)."
    "; sleep(3); echo $browser->send_post_query("http://httpbin.org/post", $data, "application/x-www-form-urlencoded", 1)."
    "; sleep(3); echo $browser->send_post_query("http://httpbin.org/post", $data, "application/x-www-form-urlencoded", 1, "X-Insta-Forwarded-For")."
    "; sleep(3); echo $browser->send_post_query("http://httpbin.org/post", json_encode($data), "application/json; charset = utf-8")."
    "; sleep(3); $param = array("key" => 1, "id" => 2); echo $browser->send_post_query("http://httpbin.org/post", json_encode($param), "application/json; charset = utf-8"); //РєРѕРЅРµС † echo "

    "; //Quit $app->quit(); ?>
    Python example: # Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7013" from xweb_human_emulator import * # Start echo("
    browser.xxxxxxxxx
    ") # post request data = "Nick1 = 111 & Nick2 = 123" echo(browser.send_post_query("http://httpbin.org/post", data)) sleep(3) echo(browser.send_post_query("http://httpbin.org/post", data, "application/x-www-form-urlencoded", 1)) sleep(3) echo(browser.send_post_query("http://httpbin.org/post", data, "application/x-www-form-urlencoded", 1, "X-Insta-Forwarded-For")) sleep(3) # 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:7010"; InitXHE(); //Start echo("
    browser.send_post_query
    "); //1 step echo("1.Execute a post request(print the length of the response):"); echo(browser.send_post_query("http://webemulator.com/poligon/post.php", "Nick1 = 111 & Nick2 = 123") .Length + " n"); //step 2 echo("2.Execute a post request with atypical parameters(display the length of the response):"); echo(browser.send_post_query("http://webemulator.com/poligon/post.php", "Nick1 = 111 & Nick2 = 123", "application/x-www-form-urlencoded", true) .Length); //step 3 echo("3.Execute a post request with atypical parameters(display the length of the response):"); echo(browser.send_post_query("http://webemulator.com/poligon/post.php", "Nick1 = 111 & Nick2 = 123", "application/x-www-form-urlencoded", true, "X-Insta-Forwarded -For ").Length); //end echo("

    "); 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("
    browser.send_post_query
    "); //post request var data = "Nick1 = 111 & Nick2 = 123"; //1 step echo("1.Let's execute a simple post request:"); echo(browser.send_post_query("http://webemulator.com/poligon/post.php", data)); //step 2 echo("2.Execute post - request application/x-www-form-urlencoded with setting content to browser:"); echo(browser.send_post_query("http://webemulator.com/poligon/post.php", data, "application/x-www-form-urlencoded", 1)); //step 3 echo("3.Execute post - request application/x-www-form-urlencoded with setting the content to the browser and the header X-Insta-Forwarded-For:"); echo(browser.send_post_query("http://webemulator.com/poligon/post.php", data, "application/x-www-form-urlencoded", 1, "X-Insta-Forwarded-For")); //end echo("

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