How to use the http library or get data from a webpage
1 replies, posted
Hi i would like to know how I can access my a webpage via. a script eg.
I have this site setup and i would like to get its data
[url]http://phptestsite.comeze.com/return.php[/url]
All it is is this atm but I will make more use of it once i figure things out
[code]
<?
echo "Return data here"
?>
[/code]
So what I want to know is there a function that I can call and have it return the data
[code]
MyData = AccessWeb(SiteURL)
[/code]
Sort of like that
http.Fetch would be what you're looking for. Note that all functions that require a response such as database, http, etc, you need a call-back, which is what these nested functions are. You can use your own; but it won't be processed instantly, and the rest of your game-mode/script will continue running while it's fetching.
[lua]http.Fetch( "website URL",
function( contents )
// On success
end,
function( )
// On Error
end
)[/lua]
Sorry, you need to Log In to post a reply to this thread.