fetchGetVariable()
From Hack Wars Wiki
| Function information for fetchGetVariable() | |
| Function | fetchGetVariable(string key) |
| API | HTTP |
| Cost | $500 |
| Level | 35 |
| CPU Usage | 1 |
| Description | Similar to $_GET in PHP, this function will get variables from the URL in the form of "website.hw?varname1=value1&varname2=value2" where the variable names can be anything, the values can be anything, and there can be an infinite amount of variables given using the & symbol. |
Example
Let's say we have this link on a website:
<a href="blubification.hw?page=poems&poem=3&user=0">Ghost: Soliloquy</a>
The following code in the Enter section of the HTTP script allows you to obtain the variables in the URL.
string page=fetchGetVariable("page"); int poemnumber=parseInt(fetchGetVariable("poem")); int usernumber=parseInt(fetchGetVariable("user")); |
Here, page is equal to "poems", poemnumber is equal to 3, and usernumber is equal to 0.
If you are familiar with PHP it's the same as $_GET[]
See parseInt().
See Multiple Pages
