Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

upload json/download xlsx file to/from www.xxx.co.xx

289 views
Skip to first unread message

timepro timesheet

unread,
Sep 1, 2022, 10:52:25 PM9/1/22
to
hi:

my app is in xhb+dbf+ps32+wvw

from my app's billing screen, user selects an invoice (e.g. inv#:'ABC_1234/22-23' record# 44892), clicks on 'make-json' (menu to prom) to create a .json file of that invoice (jfile).
e.g. jfile=diskname()+':\TAX\INVOICE\JSON_OUT\'+jsonfilename.json
-this process is already coded & running proper.

now, can this be programmed from within my app:
1. open www.xxx.co.xx (predefined variable)
2. login with username,password & the 'captcha' (user,psw are predefined)
3. open/click the specific 'bulk-upload' tab (in the opened www.xxx.co.xx)
4. upload the 'jfile'
-www.xxx.co.xx will now validate & generate a file (embedded with qrc) to be downloaded. (options: xlsx / json / xml / zip)
5. download/save the generated 'xlsx' file (e.g. ABC_123.XLSX) to diskname()+':\TAX\INVOICE\JSON_IN folder
6. replace 'qrc_xls' field with ABC_123.XLSX in record#44892 (INVTAX.DBF)

the user does not have to click/hit any key.
(all this time, the screen would 'continue' to show inv# ABC_1234/22-23 details.)

thank you

timepro timesheet

unread,
Sep 2, 2022, 2:14:29 PM9/2/22
to
hello all:

upon scouring & poring over various threads, i managed to reached here:
(this is the first, am experimenting/coding with: turl, cPassword, tipclienthttp...)

oUrl := TUrl():new("http://xxxxx.tax.gov.xx") && how to 'httpS' in place of 'http'
oUrl:cUserId := "myname"
oUrl:cPassword := "mypass1234"
oConn:=TipClientHttp():New(oUrl,.t.)
//IF oConn:Open()
//cPageContent:=oConn:ReadAll() && len(cPageContent) returns 0
//oConn:Close()
//ENDIF

-how to auto login with cUserId & cPassword. (also how to validate if userid/password are valid)
after successful login (http://xxxxx.tax.gov.xx)
a] how to get the specific 'bulk-upload' tab opened/activated/clicked (it asks file to be uploaded)

b] how to get my jfile.json uploaded.

c] post validation, how to download the generated .xlsx file to diskname()+':'\folder\subfolder2\downloadedfilename.xlsx
OR
after a] & b], the user would download the generated (.xlsx) file manually.
(for this http://xxxxx.tax.gov.xx has to be open/visible on screen - mouse over the 'download-file' link)

thank you

Message has been deleted

timepro timesheet

unread,
Sep 3, 2022, 12:08:02 PM9/3/22
to
for most of you, it's easy-peasy, but i am an average skilled programmer.
(pre-xhb) used to code in clipper. ('i don't know what i don't know')

please would any of the xhb gurus assist me with the syntax/command for:
************************************
function loginwebsite_touploadfile
************************************
1. open 'https://websiteaddress' from inside by app's invoicing screen. (xhb+wvw+dbf+ps32)
2. auto-login with userid,password,'captcha' (userid, password are predefined)
3. open/clickon specific 'bulk-upload' tab (in the logged https://websiteaddress)
-in the logged site, the user will browse & manually upload/download the json/xlsx file-
(return to the invoicing screen, on exiting websiteaddress)
*eofunc

thank you

timepro timesheet

unread,
Sep 11, 2022, 9:14:32 PM9/11/22
to
'https://websiteaddress' will open on the screen.
> 2. auto-login with userid,password,'captcha' (userid, password are predefined)
> 3. open/clickon specific 'bulk-upload' tab ('bulk-upload' would be a variable)
> -in the logged site, the user will browse & manually upload/download the json/xlsx file-
> (return to the invoicing screen, on exiting websiteaddress)
> *eofunc
>
> thank you

could someone/anyone program this 'PROFESSIONALLY'?. (with a .prg file source code)
for steps 1 & 2: us$100.
for steps 1 & 2 & 3: us$250.
(my app would just call your function with the relevant parameters).


timepro timesheet

unread,
Sep 22, 2022, 5:38:41 AM9/22/22
to
ok, i will up the ante.
for step 1 & 2: us$300.00.

Enrico Maria Giordano

unread,
Sep 22, 2022, 7:07:09 AM9/22/22
to
Il 22/09/2022 11:38, timepro timesheet ha scritto:

> 2. auto-login with userid,password,'captcha' (userid, password are predefined)

The problem is the point 2. I don't think it is so easy or possible at all.

--
Enrico Maria Giordano

http://www.emagsoftware.it
http://www.emagsoftware.it/emgmusic
http://www.emagsoftware.it/spectrum
http://www.emagsoftware.it/tbosg


Dan

unread,
Sep 22, 2022, 10:12:12 AM9/22/22
to
Il 22/09/2022 13:07, Enrico Maria Giordano ha scritto:
> Il 22/09/2022 11:38, timepro timesheet ha scritto:
>
>> 2. auto-login with userid,password,'captcha' (userid, password are
>> predefined)
>
> The problem is the point 2. I don't think it is so easy or possible at all.
>
Agreed. How to decode a captcha? The only way is to download the image,
pass it to an OCR and read the output. While I have a program that does
something similar, captcha is made exactly to avoid such a solution: the
OCR would be fooled by the messy image.
So, no way to overcome it, IMHO.

Dan

timepro timesheet

unread,
Sep 22, 2022, 11:33:49 AM9/22/22
to
enrico, dan thanks for the interest.

so, if not for the captcha, (from inside my app) can it be coded to: 'open a website, auto-login with userid & password'. (website, userid, password picked from a .dbf field).
the user could then manually type/validate the captcha. (on the open website page).
on exiting the website, return to my app's billing screen.

also, when enrico replied 'not possible', is it with xhb+wvw or with xhb+any lib...

Enrico Maria Giordano

unread,
Sep 22, 2022, 1:09:10 PM9/22/22
to
Il 22/09/2022 17:33, timepro timesheet ha scritto:

> so, if not for the captcha, (from inside my app) can it be coded to: 'open a website, auto-login with userid & password'. (website, userid, password picked from a .dbf field).

There is no standard procedure that can do that. It could still be
impossible.

Dan

unread,
Sep 22, 2022, 1:19:36 PM9/22/22
to
Il 22/09/2022 17:33, timepro timesheet ha scritto:
I think that to open the page with the browser is easy, but to interact
with the page isn't. How to automagically compile the fields user/passw?
Once the browser starts, you have no control on it, if not via OLE. The
only thing I tried has been: open the page, print it, close. Not very
much... And it worked only with IE.

Oh, and don't think to load the page in a IFRAME (or FRAME) inside a
local page carefully crafted (=with a script that modifies the
FRAME/IFRAME content). This is forbidden if the loaded page is not in
the same domain of the local page (cross-domain policy). Years ago I
studied the problem and tried some hacks, but to no avail. Google
"script injection" if you are interested. Recent improvement in
browser's security make the thing even more difficult at present.

One solution could be to download the page (quite easy with xHarbour),
modify the HTML (now the page is simply a text file on your PC),
injecting a script able to compile the controls (a bit less easy), then
open in the browser the modified page that should result pre-compiled.
Unsure, however. Never tried such a thing.

Dan

Ella Stern

unread,
Sep 22, 2022, 2:11:56 PM9/22/22
to
If the login is done via GET request, the user and password are always URL parameters.
If the login is done via POST request, only JavaScript code can do it, browsers are not able to "post".
Anyway, you cannot open a local .html file generated dynamically by your desktop app (see Dan's comment), but you can call your own web app to do many more things for you.

And in order to get back to the desktop app there are needed three pieces of software:
- (A) a server-side function of the website, which is able to receive a call from the website frontend, and a call the desktop app
- (B) a function of the website frontend, which is calling (A) to notify it that the user is done with the website
- (C) a function of the desktop app, which is polling periodically (A) in order to check, that the user is done with the website, or not yet


Lailton Fernando Mariano

unread,
Sep 27, 2022, 1:09:13 AM9/27/22
to
Using CURL you can do something like that, the unique point like said before is the captcha, I recommend you download capcha image and show it around
fields that will request the user/password, then after you have it you can goto the next step.

timepro timesheet

unread,
Sep 27, 2022, 12:31:46 PM9/27/22
to
emg, dan, ella, lai...@paysoft.com.br:

forget about 'captcha'. are you gurus saying even 'userid, password' (variables from a .dbf) 'just cannot' be autofilled from within my app. ?
(the user will type in the captcha)

thanks.


Lailton Fernando Mariano

unread,
Sep 27, 2022, 5:24:18 PM9/27/22
to

timepro timesheet

unread,
Oct 16, 2022, 2:53:13 PM10/16/22
to
ok, can this be programmed?
from inside my app: open hpps://thewebsite.abc
with the 'login' tab clicked. -something like SHELLEXECUTE( 0, 0, thewebsite/login, 0, 0, 1 ) -
the user will then input the userid, password, captcha.

tia

Lailton Fernando Mariano

unread,
Oct 18, 2022, 9:56:39 AM10/18/22
to

timepro timesheet

unread,
Oct 18, 2022, 10:14:52 AM10/18/22
to
On Tuesday, October 18, 2022 at 7:26:39 PM UTC+5:30, lai...@paysoft.com.br wrote:
Yes, you can do that.

thanks for the revert.

would you facilitate me with the syntax/function...
-is it a 1 line statement/function/coding...

wwwtax='httpS://einvoice1.gst.gov.in/login'
i tried, but does not work: SHELLEXECUTE( 0, 0, wwwtax, 0, 0, 1 )

Lailton Fernando Mariano

unread,
Oct 18, 2022, 10:18:23 AM10/18/22
to
try:

shellexecute(0,"open”,"https://einvoice1.gst.gov.in/login")

timepro timesheet

unread,
Oct 18, 2022, 11:22:23 AM10/18/22
to
thanks for your effort.

shellexecute(0,"open”,"https://einvoice1.gst.gov.in/login")
this does not compile.

i tried:
wwweinvoice="https://einvoice1.gst.gov.in/login"
shellexecute(0,"open",wwweinvoice)
shellexecute(0,"open",wwweinvoice,0,0,1)
shellexecute(0,0,"open",wwweinvoice,0,0,1)
but, none works.

this could be tried:
-open einvoice1.gst.gov.in
-right click on the 'login' tab.
-view the 'page source'

i too could, buy it's just beyond my 'pay grade'

Lailton Fernando Mariano

unread,
Oct 18, 2022, 11:42:56 AM10/18/22
to
If you have Skype add me and message me in there. or send me in private your number for Telegram/Whatsapp to my email lai...@paysoft.com.br

Regards.
0 new messages