Sign in to follow this  
Followers 0
lionel

SimpleNote connexion

2 posts in this topic

#1 ·  Posted (edited)

Hello,

I want convert this code PHP for AutoIt

<?php
    $request = fsockopen('ssl://simple-note.appspot.com', 443);
    if ($request) {
        echo 'connectOK<br />';
    }
    $headers_string = "POST /api/login HTTP/1.0rnHost: simple-note.appspot.comrnContent-type: application/x-www-form-urlencodedrnContent-length: 68rnConnection: ClosernrnZW1haWw9c2ltcGxlbm90ZSU0MGhvdG1haWwuZnImcGFzc3dvcmQ9bW90ZGVwYXNzZQ==";
    fwrite($request, $headers_string);
  
    $response='';
    while (!feof($request)) {
        $response .= fgets($request, 1024);
    }
    echo $response;
?>

I create this

#include <WinHttp.au3>

Global $sDomain = "simple-note.appspot.com"
Global $sPage = "api/login"
$headers_string = "POST /api/login HTTP/1.0"&@CRLF&"Host: simple-note.appspot.com"&@CRLF&"Content-type: application/x-www-form-urlencoded"&@CRLF&"Content-length: 68"&@CRLF&"Connection: Close"&@CRLF&@CRLF&"ZW1haWw9c2ltcGxlbm90ZSU0MGhvdG1haWwuZnImcGFzc3dvcmQ9bW90ZGVwYXNzZQ=="


Global $hOpen = _WinHttpOpen()
; Get connection handle
Global $hConnect = _WinHttpConnect($hOpen, $sDomain)
if @error Then MsgBox(16, "", 1)
$sData = "ZW1haWw9c2ltcGxlbm90ZSU0MGhvdG1haWwuZnImcGFzc3dvcmQ9bW90ZGVwYXNzZ=="
$hRequestSSL = _WinHttpSimpleSSLRequest($hConnect, "POST", $sPage, $sData)
if @error Then MsgBox(16, "", 2&@CRLF&@error)

MsgBox(0, "", $hRequestSSL)

but it does not work...

Please Help me ;)

Edited by lionel

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0