A site I subscribe to changed it pages and instead of trying to modify a MSIE script I'm trying to use the Internet Extender. As a test I decided to try logging in to the forum, but there is a problem with this line
conhandle=iHostConnect(tophandle, 'forum.winbatch.com', @http, 'user', 'password')
which which is not logging me in to the forum but leaves me here
Quote
Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length
What do I need to do to login to my normal start page?
The username and password passed to iHostConnect is used for Server authentication (if required). This is not the same as providing a user and password to the forum. You will need to figure out the exact HTTP request to do this. here is a nice tutorial to get you started using WinInet: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+Tutorials+HTTP~and~WinInet~-~An~Opus.txt
Automated logins to this forum are not recommended. Spambots are a constant issue with open forums like this one and new counter measures need to be added on a somewhat regular basis to keep pace with the bad guys. One of the new measures up for consideration would break any existing automated login techniques and make any non-interactive logins using page element names very difficult to implement.
As I said in my original post I'm not trying to implement an automated login to the forum. As per Deana's suggestion I looked at the Win Inet example and modified the code accordingly.
addextender("wwint44i.dll")
; The host name is the first part of the URL, minus the http://
host="forum.winbatch.com"
;And the part of the URL we wish to GET is *everything* after the host name
geturl="index.php?action=unread"
;Define output file name
outfile='C:\0ser\WinBatch\Test\Vids.htm'
; Basic web page fetch script
tophandle=iBegin(0,"","")
connecthandle=iHostConnect(tophandle, host, @HTTP, "username", "password")
datahandle=iHttpInit(connecthandle,"GET",geturl,"", 0)
rslt = iHttpOpen(datahandle, "", 0, 0);
if rslt!=200
headers=iHttpHeaders(datahandle)
AskItemList("Rslt=%rslt%",headers,@tab,@unsorted,@single)
endif
xx=iReadData(datahandle,outfile)
iClose(datahandle)
iClose(connecthandle)
iClose(tophandle)
exit
but it doesn't work.
Quote
Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length
News:
The retired WinBatch Technical Support BBS is now read-only.
Home
Help
Search
Tech Database
Downloads
Login
Register
WinBatch Technical Support Forum
Warning!
Only registered members are allowed to access this section.
Please login below or register an account with WinBatch Technical Support Forum.
Unless as TD said even the current counter measures are blocking the login.
George you still need to build the various form elements you want to pass. Please read the tutorial I previously posted. It should help you get started.
Quote from: George Vagenas on August 19, 2013, 02:31:32 PM
As I said in my original post I'm not trying to implement an automated login to the forum.
Let me put it directly then. You posted an script example that attempts to logon to this forum that had no chance of working. But if you do happen to get close and run it enough times, there is some possibility that you could find yourself locked out of the forum even before we add the next round of anti bot measures.
Well I certainly won't be posting any code that automatically logs on to this forum, though I did, as an exercise, get it working. This entire topic came about because a login script I had for a site stopped working. icookieset(Srvr, '', 'user password')
hTop = ibegin(0,"","")
hData = iurlopen(hTop, Url)
Very frustrating as another site running the essentially the same pages continued to work obviously the problem site changed their login method..
I did follow Deana's link http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+Tutorials+HTTP~and~WinInet~-~An~Opus.txt and as an exercise implemented a logon using this method. The problem with the TechDB's method is every site requires its own script where my original script initially worked for both sites.
What I have now is a generic method of logging onto a site and grabbing pages of interest. As per the TechDB article you need to go to the sites login page, but if you use Internet Explorer to do this, login and select the remember me option that's essentially all you have to do and icookieget(Srvr)
hTop = ibegin(0,"","")
hData = iurlopen(hTop, Url)
if hData==0
Ptr = binaryindexnc(Htm, ptr2, BlkPtr, @fwdscan)
if Ptr then continue
break
endif
Success = ireaddata(hData, strreplace(fVids, 'CNT', Cnt))
if !Success
message('Could not read from page!', 'ireaddata(hData, fVid)')
exit
endif
iclose(hData)
iclose(hTop)
will retrieve any pages your interested in.
Depending on the site you might have to revisit it down the road to refresh the cookie but to my mind its a small shortfall for implementing a generic logon script.