Possible to read the forum-no. from oHttp:ResponseText() ?

Possible to read the forum-no. from oHttp:ResponseText() ?

Postby ukoenig » Sat Feb 17, 2018 11:04 am

Hello,

selecting topics from the forum
they are collected by the range of numbers and the forum-number is included as 3 ( english )
Is it possible to read the REAL forum-no from < oHttp:ResponseText() > the forum belongs to < 3, 6, 20, 23 or 21 > :?:
Maybe it can be read from < oHttp:ResponseBody() > :?:

because importing by a defined range of topic-numbers it would be nice to now the last used number
from each forum to define a wanted range just for a forum.
The start-numbers can be saved to the SYSTEM.dbf

the screenshot from the SETUP-section shows what I mean
for the moment I read the newest number of a selected forum and save the value
that can be used as a new startvalue for the next import.
But maybe it can be a autosave reading from http

Image

Code: Select all  Expand view

FUNCTION WEBPAGETOPIC( cUrl, lText )
LOCAL oHttp, cContents := ""

IF Lower( Left( cUrl, 7 ) ) == "http://" .or. Lower( Left( cUrl, 8 ) ) == "https://"
    TRY
        oHttp := FWGetOleObject( "MSXML2.XMLHTTP" )
        oHttp:Open("GET", cUrl, .F. )
        oHttp:Send()

        DEFAULT lText := .F.
        IF lText
            cContents := oHttp:ResponseText()
        ELSE
            cContents  := oHttp:ResponseBody()
        ENDIF
    CATCH
    END
ENDIF

RETURN cContents
 


I can connect to any selected topic from the browser or only to the forum from the flag-selection on button-action.
After the import the column < forum > shows a ? for undefined.
Even the forum-number of all topics is 3 = english the connection works.
I can adjust the topic-link with the real forum-number on col right mouseclick selecting the
flag that belongs to the topic.
Much better would be saving the REAL forum-number during the import.

Screenshot : connected to a spanish-topic and changed image < ? > to the spanish flag in xbrowse

Image

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Possible to read the forum-no. from oHttp:ResponseText() ?

Postby ukoenig » Mon Feb 19, 2018 12:53 pm

I think I found the information for the forum-number

IF nPage == 1
nPages := PageCount( cText )
cTopic := textbetween( ctext, "<h2>", "</h2>", 1 )
cTopic := textbetween( cTopic, ">", "</a>", 1 )
// section ResponseText()
// <h2><a href="./viewtopic.php?f=6&amp;t=33494&amp;start=0">quitar color a columna xbrowse</a></h2>
cForum := textbetween( cText, "viewtopic.php?f=", "&amp", 1 )
// the needed forum-number :!:
// <h2><a href="./viewtopic.php?f=6&amp;t=33494&amp;start=0">quitar color a columna xbrowse</a></h2>
ENDIF

It seems to work during the import the countryflag is added to the browser
Now we can see the forumflag the topic belongs to

Image

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 51 guests