Difference between revisions of "Load html"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
(Created page with '{{ #vardefine:name|load_html}}{{ #vardefine:return_type|buffer}}{{ FunctionPage| name={{#var:name}}| function_category=Miscellaneous| function1={{Function| name={{#var:name}}| …')
 
imported>StDoodle
m
Line 17: Line 17:
  
  
function_description=Returns the HTML from the visited page (not just what is displayed when visiting the page, but all markup) by performing a POST request. Note that for addresses inside of KoL, it is only necessary to supply the page name for {{pspan|page}}, and KoLmafia will populate the rest of the url. However, pages outside of KoL require the full url to be supplied for {{pspan|page}}.
+
function_description=Returns the HTML from the visited page (not just what is displayed when visiting the page, but all markup) by performing a POST request. Note that for addresses inside of KoL, it is only necessary to supply the page name for {{pspan|page}}, and KoLmafia will populate the rest of the url. However, pages outside of KoL require the full url to be supplied for {{pspan|page}}.</p>
  
The main difference between this function and {{f|visit_url}} is that this function will only contact the server once each time the script is run; from then on, it will simply reload the previous html. Mainly useful for debugging, when you don't want to use extra server hits.|
+
<p>The main difference between this function and {{f|visit_url}} is that this function will only contact the server once each time the script is run; from then on, it will simply reload the previous html. Mainly useful for debugging, when you don't want to use extra server hits.|
  
 
needscode=yes|
 
needscode=yes|

Revision as of 16:40, 10 April 2010

needs(code_samples);

Function Syntax

buffer load_html(string page )

  • page is the page to visit

Returns the HTML from the visited page (not just what is displayed when visiting the page, but all markup) by performing a POST request. Note that for addresses inside of KoL, it is only necessary to supply the page name for page, and KoLmafia will populate the rest of the url. However, pages outside of KoL require the full url to be supplied for page.

The main difference between this function and visit_url() is that this function will only contact the server once each time the script is run; from then on, it will simply reload the previous html. Mainly useful for debugging, when you don't want to use extra server hits.

See Also

visit_url()

Special

Note that this function returns an empty string if the page does not exist or if the request times out.