Difference between revisions of "Make url"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
(function added in r8940. Not very useful, but it should be on the wiki anyway.)
 
(No difference)

Latest revision as of 09:14, 27 April 2011

Function Syntax

buffer make_url(string page ,boolean use_POST ,boolean encoded )

  • page is the page to visit
  • use_POST is true for a POST request and false for a GET request
  • encoded If set to true, then the url is assumed to be pre-encoded by the user.

Returns the url that would be visited if this was a visit_url(). This function was intended for troubleshooting crafted urls and has no use outside of debugging purposes.

Code Samples

Compares the URL you expect to visit with the URL that you are actually visiting. This was once useful.

buffer mbuf;
mbuf.append( "pickpocket\n" );
mbuf.append( "attack\n" );
mbuf.append( "repeat" );

string macro = mbuf.to_string();

buffer new_url;
new_url.append( "fight.php" );
new_url.append( "?" );
new_url.append( "action=macro" );
new_url.append( "&" );
new_url.append( "macrotext=" );
new_url.append( macro );

print( "crafted unencoded url = \"" + new_url + "\"");
print( "submitted url = \"" + make_url( new_url, true, false ) + "\"" );

See Also

visit_url()