Custom headers HTTP protected site

Dave Cragg dave.cragg at lacscentre.co.uk
Sat Oct 10 10:50:35 EDT 2009


On 10 Oct 2009, at 00:26, Jim Ault wrote:

> Thanks for the note.  It prompted me to try a simpler solution than  
> trying to mimic the full browser set of headers.
> I just tried adding only the following:
>
> set the httpheaders to "Authorization: Basic  
> cm90b3Bhc3MyOjUzcHJpbmNlNDY="
>
> and it worked for the web page as html.
> This will get me where I need to go for the immediate future, but I  
> would like to figure out how to use a page link to download a text  
> file.
>
> In this instance,
>   http://www.baseballhq.com/members/tools/projections/proj.php?lg=A&p=B&t=PY&ids=1&f=csv
> which normally would trigger the browser to offer the 'save as'  
> dialog.

How about:

set the httpHeaders to "Authorization: Basic  
cm90b3Bhc3MyOjUzcHJpbmNlNDY="
put url "http://www.baseballhq.com/members/tools/projections/proj.php?lg=A&p=B&t=PY&ids=1&f=csv 
" into tData
# check any errors
if the result <> empty then
  answer the result
else
   put tData into url ("file:" & "/path/to/file.txt") # sub your file  
path here
end if


Dave



More information about the use-livecode mailing list