Forum OpenACS Development: Re: how to import image via url?

Collapse
Posted by Gustaf Neumann on
Torben,

here is a short version based on the relatively new xotcl-core class ::xo::HttpRequest (cvs head)

ad_page_contract {
    @ test
} {
    { url "http://kappacorp.com/fwgoofiness.jpg" }
}

set r [::xo::HttpRequest new -url $url]
ns_headers connid [$r set status_code] [$r set content_type] [$r set content_length]
ns_write [$r set data]

Note that this version does not require you to write into the file system. Most probably, you can do similar with ns_http*.

-gustaf neumann