hb_jsonDecode() this Website

hb_jsonDecode() this Website

Postby Jimmy » Sun Mar 19, 2023 4:10 am

hi,

i try to use hb_jsonDecode() for "this" Website but i got NIL ...

---

my old working Way
Code: Select all  Expand view
  cUrl := "https://forums.fivetechsupport.com/viewtopic.php?t=42918"
   oHttp:Open( "GET", cUrl, .F. )
   oHttp:setRequestHeader( "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0" )

   oHttp:Send()

   IF nStatus = 200
      StrFile( oHttp:ResponseBody(), cFile )

this way i got Website from "cURL" as "cFile" in HTML Format which i try to "analyze" to get Information

...

1st Try :

Code: Select all  Expand view
PROCEDURE TestJSON()
LOCAL cFile, cMemo, aReturn,ii,nMax,aArray

   cFile := "d:\PHPFORUM\FWH\T0042918.HTML"
   cMemo := MEMOREAD(cFile)
   aReturn := hb_jsonDecode(cMemo, @aArray )
altd()

RETURN

i try to use cFile which i have download above
but aReturn is NIL and aArray is Empty ...

what i´m doing wrong :?:

---

i try to change oHttp:setRequestHeader() to
Code: Select all  Expand view
  oHttp:setRequestHeader( "Content-Type", "text/xml; charset=utf-8")

and try
Code: Select all  Expand view
  * x1 := hb_jsonDecode( oHttp:responseText, @aArray )
   x1 := hb_jsonDecode( oHttp:ResponseBody(), @aArray )
   altd()

but still Result x1 is NIL and aArray is Empty ...

---

can somebody show me how use use hb_jsonDecode() for "this" Website :?:
need some help please
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1589
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: hb_jsonDecode() this Website

Postby nageswaragunupudi » Sun Mar 19, 2023 7:50 am

hb_jsondecode( cJson, @hHash )
works only if the first parameter is a vaid json text.
If valid, second param by ref is filled with Hash.

In this case. the responsetext() is NOT json text.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10249
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: hb_jsonDecode() this Website

Postby Jimmy » Sun Mar 19, 2023 8:26 am

hi,

thx for Answer.
nageswaragunupudi wrote:hb_jsondecode( cJson, @hHash )
works only if the first parameter is a vaid json text.
If valid, second param by ref is filled with Hash.

In this case. the responsetext() is NOT json text.

ok understand
so hb_jsondecode() is not a Solution for phpBB System "generated" Website
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1589
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Enrico Maria Giordano, nageswaragunupudi and 12 guests