PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → JSON + HPPPRequest - What I do Wrong As It does not work !  H E L P !!!
JSON + HPPPRequest - What I do Wrong As It does not work ! H E L P !!!
Iniciado por santtu55, 11,nov. 2014 10:45 - 1 respuesta
Publicado el 11,noviembre 2014 - 10:45
This code gets 'HTTP1.1 200 OK' which means that it returned ok and success
but does not log me in ? I have put login and password as 'my login' and ' mypassword'.
I use WIndev 17, Internal Version: 01A170078p

In which way login and passwrod must be indicated in this code ???

Could some one help me what I do wrong ??? Please HELP !!!

LOCAL
sHeaders is string = "Content-type:application/json,Accept:application/json,X-ESA-API-Key:ROBOT"
sPelihaku is string = "api/v1/sport-games/draws?game-names=MULTISCORE"
sUser is string = "{login: my login, password: mypassword, type: STANDARD_LOGIN}"
sApi is string = "api/v1/sessions"
sSessionID, sHeader is string

fDelete( "C:\Asioita\Sessionhaku.txt" )
fDelete( "C:\Asioita\Sessionhaku.htm" )

HTTPCookieManage(".veikkaus.fi", True)

HTTPRequest( ...
"https://www.veikkaus.fi", ...
"", ...
sHeaders, ...
sApi + ":" + sUser, ...
"application/json" )

sHeader = HTTPGetResult( httpHeader )

IF Position( sHeader, "HTTP/1.1 200" ) > 0 THEN
sSessionID = NoSpace( ExtractString( ExtractString( sHeader, 2, "SESSIONID=" ), 1, ";" ) )
Info( "SessionID: = " + sSessionID )
fSaveText( "C:\Asioita\Sessionhaku.txt", sHeader )
fSaveText( "C:\Asioita\Sessionhaku.htm", HTTPGetResult( httpResult ) )
ELSE
fSaveText( "C:\Asioita\Sessionhaku.txt", sHeader )
Info( "Does not work" )
END
Publicado el 11,noviembre 2014 - 13:30
Hi Lasse

once again, without knowing the full spec of the webservice you are
trying to access, it's impossible to help you, as there are many ways to
pass a username/password, and it depends on what the webservice doc says

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

NEW: WXReplication, your open source replication system is available on
my web site!!!
WXShowroom.com: Show your projects!
More information on http://www.fabriceharari.com


On 11/11/2014 4:45 AM, "Lasse Sandström" wrote:
This code gets 'HTTP1.1 200 OK' which means that it returned ok and success
but does not log me in ? I have put login and password as 'my login'
and ' mypassword'.
I use WIndev 17, Internal Version: 01A170078p

In which way login and passwrod must be indicated in this code ???

Could some one help me what I do wrong ??? Please HELP !!!

LOCAL
sHeaders is string =
"Content-type:application/json,Accept:application/json,X-ESA-API-Key:ROBOT"
sPelihaku is string =
"api/v1/sport-games/draws?game-names=MULTISCORE"
sUser is string = "{login: my login, password: mypassword,
type: STANDARD_LOGIN}"
sApi is string = "api/v1/sessions"
sSessionID, sHeader is string

fDelete( "C:\Asioita\Sessionhaku.txt" )
fDelete( "C:\Asioita\Sessionhaku.htm" )

HTTPCookieManage(".veikkaus.fi", True)

HTTPRequest( ...
"https://www.veikkaus.fi", ...
"", ...
sHeaders, ...
sApi + ":" + sUser, ...
"application/json" )

sHeader = HTTPGetResult( httpHeader )

IF Position( sHeader, "HTTP/1.1 200" ) > 0 THEN
sSessionID = NoSpace( ExtractString( ExtractString( sHeader, 2,
"SESSIONID=" ), 1, ";" ) )
Info( "SessionID: = " + sSessionID )
fSaveText( "C:\Asioita\Sessionhaku.txt", sHeader )
fSaveText( "C:\Asioita\Sessionhaku.htm", HTTPGetResult(
httpResult ) )
ELSE
fSaveText( "C:\Asioita\Sessionhaku.txt", sHeader )
Info( "Does not work" )
END