Http async
Revision as of 20:58, 4 May 2024 by Mortmann (talk | contribs) (Created page with "The ::http::geturl command blocks until the operation completes, unless the -command option specifies a callback that is invoked when the HTTP transaction completes. <pre> package require http proc httpCallback {token} { regexp {(?i)<title>([^<>]+)} [http::data $token] -> title http::cleanup $token puts "Title was \"$title\"" } set token [::http::geturl http://netbsd.org -timeout 10000 -command httpCallback] <pre>")
The ::http::geturl command blocks until the operation completes, unless the -command option specifies a callback that is invoked when the HTTP transaction completes.
package require http proc httpCallback {token} { regexp {(?i)<title>([^<>]+)} [http::data $token] -> title http::cleanup $token puts "Title was \"$title\"" } set token [::http::geturl http://netbsd.org -timeout 10000 -command httpCallback]