1. getting data from password prot. webpage

Hello All,

I'm new here. It happened I decide to use Euphoria for commercial and free
programming.
This is really a great tool for a multiplatform developer. Great thanks for the
authors!

So, I have a question: is it possible to get data (the complete http page) from
a
password protected webpage? Ofcourse I know the login data and the page using 
php POST authentication. I would like to make an automatic data processor for
that page, to have statistics.

Is it possible, what do you think guys?

Thanks in advance,
Mark from Hungary

new topic     » topic index » view message » categorize

2. Re: getting data from password prot. webpage

Use libURL.

JG

new topic     » goto parent     » topic index » view message » categorize

3. Re: getting data from password prot. webpage

Julio C. Galaret Viera wrote:
> 
> Use libURL.

I use wget.

Kat

new topic     » goto parent     » topic index » view message » categorize

4. Re: getting data from password prot. webpage

Mark Gabor wrote:

> So, I have a question: is it possible to get data (the complete http page)
> from
> a 
> password protected webpage? Ofcourse I know the login data and the page using
> 
> php POST authentication. 

Sure. Here's an extract of code I use, using eulibcURL.

atom curl_handle
atom errp -- curl error
errp = allocate(CURL_ERROR_SIZE)

if  curl_global_init(CURL_GLOBAL_ALL) != 0 then
	warnErr("Could not initialise libCurl\n\nContinue?")
end if
curl_handle = curl_easy_init()
void = curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, errp)
void = curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1)

void = curl_easy_setopt(curl_handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP)
void = curl_easy_setopt(curl_handle, CURLOPT_PROXY, "")
void = curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE,
"C:\\EUPHORIA\\Direct_cookies")
void = curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR,
"C:\\EUPHORIA\\Direct_cookies")
void = curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "Opera/9.21 (Windows NT
5.1; U; en)")

void = curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0)
-- CURLOPT_CAINFO and CURLOPT_CAPATH would be used to point to certificates,
-- but the line above says not to verify the SSL certificate

-- put your logon sequence into form_data
if sequence (form_data) then
	void = curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, form_data)
else
	void = curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1)
end if

void = curl_easy_setopt(curl_handle, CURLOPT_URL, url)
if sequence(form_data) then
	showMessage(sprintf("Downloading file %s : %s",{url,form_data}))
else
	showMessage(sprintf("Downloading file %s",{url}))
end if
buffer = curl_easy_perform_ex(curl_handle)
if atom(buffer) then
showMessage(sprintf("Error '%s' downloading file", {peek_sequence(errp,
CURL_ERROR_SIZE) } ) )
else
	--process the data
end if

curl_easy_cleanup(curl_handle)
curl_global_cleanup()
free(errp)


-- 
Craig
Euphoria friendly webhosting: http://www.wazu.jp/hosting/euphoria.html

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu