I'm hoping someone can help with what must be something really easy but for the life of me I can't see where the error is.
Basically, what i'm trying to do is integrate a UPS 'Track by Reference' tool in to my application. Now after taking the UPS page apart (which i've included) I can see that it gets the information from the page and using the POST method for form. After having a good look around some forum posts here I put some code together which I thought would do the trick. Which is:
Code:
Imports System.Text
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim vHeader, vURL, vPostData
vHeader = "Content-Type: application/x-www-form-urlencoded" & Chr(10) & Chr(13)
vURL = "http://wwwapps.ups.com/WebTracking/reference"
vPostData = ASCIIEncoding.ASCII.GetBytes("shipmentType=package&ReferenceNumber=123456789&FromPickupDay=&FromPickupMonth=6&FromPickupYear=2007&ToPickupDay=8&ToPickupMonth=9&ToPickupYear=2007&DestinationCountry=gb&AgreeToTermsAndConditions=yes&HIDDEN%5FFIELD%5FSESSION=jMs?@VLq?@|bZusm\V@rJfLd[vLhZuwmQEdcXETmPeddZEPHZV@kS~hEh|VjKN[K??@w[F[K???@DC@UMVC????B[vG?CUh`\eCm\VPhZAxGWVLgRUDo@O^Yo[KUWLCB??HE??hkZuDcPeDb\E|qQO?H\E`qXVLgZupc]F?~O???????BF[G????C?????Hs??lGQSPCPSx^RCdRTFLq?@LiWVX`JfTsYUomQEDrYFP`WepdCzkNHQDIxJ_B??HE??hkZuDcPeDb\E|qQO?H\E`qXVLgZupc]F?~O???????AF[G????Ao????Ds??LkZuLs??TdZd|FOf`s?@LSScDBQt|COTP@VspHRcTHTCTL[F`w&loc=en%5FGB")
WebBrowser1.Navigate(vURL, "", vPostData, vHeader)
End Sub
End Class
Now when I click the button to update the WB with what should be the results of my search, I just get the main 'Track with Reference' page with the boxes filled in with the data I put in my application, but when I use the same info in the stripped down version of the html I made it all works fine.
I have included the stripped down htm file and a screenshot of both how the results should look (ups tracked.bmp) and also the one where it chucks me back to the start with my application (ups default.bmp).
I hope I explained what I wanted in full and didn't lose anyone on the way
Hmm, after a little more investigation I think the problem perhaps lies in the fact its not telling the form to return information. On the original .htm page theres a line of code tied in with the submit button which is:
Code:
onclick="return wrapperCheckTerms(refinput);
Could this be the problem with why its just going to the default screen with the boxes filled in? If so, how would I implement it into my original code?
Also, i've been looking at the option of taking the users input and piecing it together before passing it to the WB as if the user was doing it from the tracking site. Although it might be a little simpler, its a pretty sloppy way of doing things.
Any help anyone could give would be greatly appreciated.
I suggest you check those out, as what you are trying to do would likely work up until UPS changes the slightest thing on their site that makes your code not work anymore
Thanks for that. Although I cant see that it specifically uses track by reference, but then again their discription of 'Tracking' is a little vague.
You also make a good point of using a tool they offer instead of hashing something together for them to only later change. I just wish their sign-up procedure didn't take forever! I know have to wait for a UPS rep to contact me about arranging to get a UPS account number!
Hmm, tried their sample one they had there and no joy. Plus I'd be tracking with reference numbers that our warehouse puts on goods for our own record keeping and so this option wouldn't be viable from what I can see