Custom headers HTTP protected site
Jim Ault
jimaultwins at yahoo.com
Sat Oct 10 11:16:33 EDT 2009
Yes, it does work.
> 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
Funny how I thought I tried it before and got an empty data file, but
obviously I had something different. I think I got caught up in
trying to use LiveHeaders => custom headers before I discovered I did
not need anything more than the Authorization header + default Rev
headers.
This is very cool that Rev once again falls into the category of
elegant simplicity.
Step one is to use a ping to domain.com/page.php to get the headers
for today
Step two is to extract the Authorization header
Step three is set the httpHeaders and put the url into a variable.
Thanks again,
Jim Ault
Las Vegas
On Oct 10, 2009, at 7:50 AM, Dave Cragg wrote:
>
> 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