Shot in the dark... CASE RE-OPENED
This is a really vague question, so apologies to all you wunnerful people!
Company I work for has a shipment tracking website with a field where you pop in a shipment number, hit enter and another page pops up showing the various "milestones". Looks like I'm going to be tracking a number of these beasties in the future, so I'm wondering, is there anyway I could knock up a little VB app that would automatically submit the shipment numbers to the page and then grab the resulting info?
The page with the search field on ends ".asp" and the results page (which opens in another IE instance) ends with ".exe". Would the bit I stole from the search page below be of any use?
HTML Code:
<form ACTION="../Cgi-Bin/TSCGI.exe" METHOD="POST" NAME="TrackIT" TARGET="Result">
<tr>
<td width="50"></td>
<td ><H1> Package ID:</H1>
<input TYPE="text" SIZE="23" MAXLENGTH="20" NAME="ShipmentReference" />
<input class="button" TYPE="submit" NAME="Search" VALUE="Search" />
</td>
</tr>
</form>
Re: Shot in the dark... RESOLVED
Does the reference ID ever change? If so, you could replace the URL with "http://tracking.exel.com/tracking/shipmentstatus/Cgi-Bin/TSCGI.exe?
ShipmentReference=" & trim(RefID) & "&Search=Search"
(trim trims spaces to the left and right of the ID...just in case :-))
Re: Shot in the dark... RESOLVED
smUX, yep, I'll be using this to search for info on all sorts of shipments, so you're right of course, I'll need to insert the ref as you've indicated above. Thanks!
Re: Shot in the dark... RESOLVED
You might also want to integrate a listbox or listview with a list of all the shipments you're tracking at a time...you could have textbox(es) at the bottom for the ability to add new tracking orders...and you could have an "update all" function that does each ID in the listbox/view easy enough :-)
Your choice about how you'd delete from the list...you could have it so clicking puts it into the "add" textbox you use to add new names and could also have an "update" and "delete" button next to the "add" button, or clicking deletes the name from the list (former is better, latter is faster to delete but also more prone to error when you delete something you don't want to delete) :-)
Re: Shot in the dark... CASE RE-OPENED
Sorry to bring this all up again. I got my previous app working perfectly, btw, so thanks again.
Anyway, the question is now - we have another site that I'd also like to automatically query, but this one seems to use the POST method instead of SUBMIT. This page is at http://sci2.exel.com
Once again, the parsing is no problem for me - it's the first dipping-the-toe-in-the-water when dealing with logins like this (and keep the subsequent pages logged in too I guess) that I've no experience of.
Hope this makes sense!
Cheers
Re: Shot in the dark... CASE RE-OPENED
Re: Shot in the dark... CASE RE-OPENED
Whack!
lol...
hey, take a look at the webbrowser control tutorial on my website..
(link in my sig)
in this case u will need:
username
userpassword
and using the webbrowser control (Or just the HTML object...)
you can fill out the forms and parse the data back in
one note: a submit image is used...
so u wont be able to just submit.click... you will need to loop thru inputs and click it when found.. I would use the alt tag ("submit")
i have a sample on my site how to do something very similar
if u still get stuck.. let me know
Re: Shot in the dark... CASE RE-OPENED
Ok, so thanks to you guys, I got a very neat little app working that grabs all sorts of info. My boss loves it, but... just when I got it working, they decided to switch everything to a new site.
https://interactive1.dhl.com/TrackRe...ller/anontrack
I've been faffing around for a while now, trying to figure out how to get the correct URL to query, but I'm stuck. Anyone got any ideas?
Re: Shot in the dark... CASE RE-OPENED
Bump!
I'll lose my no-claims bonus if I keep bumping like this...
Re: Shot in the dark... CASE RE-OPENED
Code:
https://interactive1.dhl.com/TrackReport/controller/AnonShipmentTracking?SearchType=HBN&SearchValue=AMS02-00150412
Dunno if it will work from code but it works if firefox :)
P.S. i would test it but i only have .net 2005 installed and i am not sure how differently it may/may-not handle the "https"...
anyway good luck
Re: Shot in the dark... CASE RE-OPENED
Vyper, thanks very much for replying, much appreciated. That does work, and I've programmed it up accordingly - you're a star! :afrog:
Re: Shot in the dark... CASE RE-OPENED
no prob, glad it worked for you.
Re: Shot in the dark... CASE RE-OPENED
Code:
Module Module1
Sub Main()
Dim WebRetr As New System.Net.WebClient
WebRetr.DownloadFile("https://interactive1.dhl.com/TrackReport/controller/AnonShipmentTracking?SearchType=HBN&SearchValue=AMS02-00150412", "c:\lookup\AMS02-00150412.html")
End Sub
End Module
Here is a quick an dirty vb.net console app for the same purpose - though in a real situation one would either take the tracking info from either command-line or better yet getting it from a SQL Query...