HTTPS / CURL

Greetings all,

I’m trying to load a page from a secure website to extract data from it. I have valid login credentials for it for testing. For the life of me I can’t get it going through SecureSocket, or libcurl or CurlMBS.

The main problem is that I can’t find a simple example I can duplicate to accomplish this.

Does anyone have any experience doing this where I can pick you brain a bit?

Thanks in advance.

Cheers
Grant

What have you tried?

Normally the “CURLS text download” sample project should do it.

If the page needs to login, you may first need to send the login form and than go to the right page passing whatever cookie they send you.

[quote=269482:@Christian Schmitz]What have you tried?

Normally the “CURLS text download” sample project should do it.

If the page needs to login, you may first need to send the login form and than go to the right page passing whatever cookie they send you.[/quote]

Christian,

Thanks for your reply. Tried your example and it does not work for me. My site doesn’t use a form for login, it uses the OS window to login.

Other than setting the username and password properties for CURLSMBS is there anything else I may be missing?

Cheers
Grant

Is it NTLM authentication by any chance? I don’t know if Xojo’s new framework supports that. I had to run my own implementation of WinHTTP to get that going - see my article from way back when http://www.xdevmag.com/browse/7.2/7210/
@Christian Schmitz : is NTLM supported in your CURL implementation?

Thanks Mattias, I have all the back issues. Checking it out now.

Cheers
Grant

WinHTTP is nothing for the faint of heart…
We are still on 2014r2.1 for that project, but have done some initial testing with 2016r1.1 and Xojo.Net.HTTPSocket. Most of the stuff actually work, but the legacy (and from Windows 8 non-sanctioned) way of having WPAD as files on the local system is not supported by Xojo.Net.HTTPSocket.

Mattias, is it possible to obtain a copy of your implementation?

Cheers
Grant

I wish I would be able to provide you with a copy but sadly the implementation is a mess and tightly integrated into the main project and I haven’t had the time to re-visit it.
Have you tried the new framework? Did it not work?

Mattias,

I have not tried the new framework. Does it apply to Windows as well?

Cheers
Grant

Xojo.Net.HTTPSocket works for Windows Desktop apps (no support yet for WabApps running on Windows according to the docs).

Nup it doesn’t apply yet. Back to square 1.

Cheers
Grant

Doesn’t work or not applicable to your target?

Have you tried to just use CURL from the command line to make sure your syntax is correct? If you are using Windows there are some pre-compiled binaries that I have used before with good success. In general I follow the technique of coding complex “stuff” like CURL or SQL in a standalone tool then move it to Xojo because the diagnostics are easier to use.

The static CURLSMBS class has NTLM support compiled into it.
Maybe using something along the lines…? Haven’t tested
curl http://somewhere -v --ntlm --negotiate -u user:password

You need to change the HTTP authentication mode to NTLM. MBS, libcurl.

please try. If you have problems, you can always email me :slight_smile:

Thanks all. Thanks Christian.

I’ve done some testing using CURL on Mac (although ultimately I need it for Windows 7), and I’ve found out the following via some of the output back form the server:

[code]Server: IBM_HTTP_Server

  • TLS 1.0 connection using TLS_RSA_WITH_RC4_128_MD5
  • Server certificate: XXXXXXXX.gov.au
  • Server certificate: Symantec Class 3 Secure Server CA - G4
  • Server certificate: VeriSign Class 3 Public Primary Certification Authority - G5
    < WWW-Authenticate: Basic realm=LDAP User Name/Password
  • Server auth using Basic with user ‘XXXXXX’
    [/code]

• I must have cookies enabled.
• I must set a known user-agent.

More testing to do when I get home from work tomorrow.

Will give CURLSMBS a try first. Any more tips Christian?

Cheers
Grant

You can use the OptionCookieFile to use a cookie file and CURL handles cookies for you.
OptionUserAgent is also there.