POST to HTTPS

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ljohann
Posts: 2
Joined: Thu Mar 01, 2007 1:35 pm
Location: Muenster, Germany
Contact:

POST to HTTPS

Post by ljohann » Fri Mar 02, 2007 11:56 am

Hi,

I'm trying to access Google-Calendar with Revolution.

Using "post" does, however, seem not to work in combination with "https".
The code-snippet I use looks like this:

Code: Select all

put  URLEncode("Email=XXXXX@gmail.com&Passwd=XXXXXXX&source=FMDB-1&service=cl") into field "Output"
post field "Output" to URL "https://www.google.com/accounts/ClientLogin"
if the result is empty then
    answer it 
else
    answer the result
end if
It results in an "error socket closed". The libURL Log reads:
socket selected: www.google.com:443|6926
CLOSED www.google.com:443|6926
Using the same code with http instead of https works fine in
terms of getting contact with the server, but of course will not
do the login (returns: "error 302 Moved Temporarily", indicating
that Google moved the ClientLogin to a secure server).

Any idea?

Best wishes,

Lars
[img]http://www.phenotyping.com/bartboard.gif[/img]

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Location: London, UK
Contact:

Re: POST to HTTPS

Post by Mark Smith » Sun Mar 04, 2007 2:05 am

ljohann wrote: Using the same code with http instead of https works fine in
terms of getting contact with the server, but of course will not
do the login (returns: "error 302 Moved Temporarily", indicating
that Google moved the ClientLogin to a secure server).
Lars
Lars, which version of Revolution do you have?

Anything below 'Enterprise' does not support https connections out of the box. You used to be able to buy an add-on to support https, but I think RunRev have discontinued that (I have no idea why), but if you really need it, then you could try emailing RunRev support, and see if they'll help.

Failing that, you can probably do what you need using either Curl or Wget shell calls.

Best,

Mark

ljohann
Posts: 2
Joined: Thu Mar 01, 2007 1:35 pm
Location: Muenster, Germany
Contact:

Google calendar: Tennis with Beth

Post by ljohann » Sun Mar 04, 2007 2:45 pm

Hi,

Thanks a lot, Mark! Using curl does the trick. However, I would appreciate if this worked without an external shell command.

BTW, I have Rev 2.8.0 studio and the docs lack a hint to the missing HTTPS implementation as far as I can see. If anyone knows
an easy way to do this with sockets (and maybe openSSL?), please let me know.

Now, here is the working code (Win XP) to add an event to your GoogleCalendar:
(You'll need )

Code: Select all

local curlPATH, curlVAR, curlURL, curlCMD, fcharSSID, lcharSSID, SSID
on mouseUp
  put "C:/curl/" into curlPATH
  put "https://www.google.com/accounts/ClientLogin" into curlURL
  --URLEncode the whole string does not work!
  put QUOTE &"Email="&URLENCODE("XXXXXXX@gmail.com") &"&Passwd=XXXXXXX&source=curl&service=cl" &QUOTE into curlVAR 
  put "curl -d " into curlCMD
  get shell (curlPATH &curlCMD &curlVAR &" " &curlURL)
  put  it into field "output" 
  
  --read the AUTH string
  set the itemdelimiter to "="
  put the last item of field "Output" into AUTH
    
  --the rest works as a POST request 

  put "http://www.google.com/calendar/feeds/default/private/full" into curlURL
  put "Content-type: application/atom+xml" &LF &"Authorization: GoogleLogin auth=" &AUTH into field "HEADER"
  set the HTTPHeaders to field "HEADER"
  post field "newevent" to curlURL
  put it into field "Output"

  --Google sends a SSID cookie that has to be included if the first attempt fails
  if field "Output" contains "Moved Temporarily" then
    put offset("gsessionid=",field "Output") into fcharSSID
    put offset(">here<",field "Output")- 2 into lcharSSID
    put char (fcharSSID) to (lcharSSID) of field "Output" into SSID
    post field "newevent" to curlURL &"?" &SSID
    put it into field "Output"
  end if
end mouseUp
Best wishes,

Lars
[img]http://www.phenotyping.com/bartboard.gif[/img]

Post Reply

Return to “Internet”