hb_jsonDecode() this Website

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

hb_jsonDecode() this Website

Post by AUGE_OHR »

hi,

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

---

my old working Way

Code: Select all

   oHttp:Open( "GET", cUrl, .F. )  // https://www.hmgforum.com/viewtopic.php?t=7403
   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

PROCEDURE TestJSON()
LOCAL cFile, cMemo, aReturn,ii,nMax,aArray

   cFile := "d:\PHPFORUM\HMG\T0007403.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

   oHttp:setRequestHeader( "Content-Type", "text/xml; charset=utf-8")
and try

Code: Select all

   * 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
have fun
Jimmy
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: hb_jsonDecode() this Website

Post by Rathinagiri »

Hi, can you give the content received in cFile? Only if it is in JSON format using {} and [] you can decode.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: hb_jsonDecode() this Website

Post by AUGE_OHR »

hi Rathi,

it was a Answer from ChatGPT when ask how to get Content of Website
it sound good so i try it "here" in this Forum

but Website "generate" by phpBB Forum Software seems not to use JSON Format
have fun
Jimmy
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: hb_jsonDecode() this Website

Post by Rathinagiri »

Yes. For getting JSON format, we need an API. There are PHPBB APIs to generate JSON for older versions of forum. Since we have updated to the latest version, it may take sometime to upgrade/update the API by the developer. Once updated, we can try to install the API.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: hb_jsonDecode() this Website

Post by AUGE_OHR »

hi Rathi,

it would be great when Forum can generate JSON "Output"
it would give us a Chance to "use" JSON and to "learn" was is need
have fun
Jimmy
Post Reply