Computer Hope

Microsoft => Microsoft DOS => Topic started by: alipierce on June 13, 2012, 02:08:41 PM

Title: cURL help: need to get page with varying date
Post by: alipierce on June 13, 2012, 02:08:41 PM
I would like to automatically fetch "get" a web page that has the date as part of its path

https://site.gov/blah/blah/decision?process_date=6%2F13%2F2012&v_dispatchid=#######&but=Reports

This is part is my problem.... 6%2F13%2F2012

As is, I have to login, click various radio buttons and prompts, until I navigate to this page.

Is there a way that cURL can find the page relative to "TODAY's DATE -1DAY"?

I'm open to suggestions... The end goal is to retrieve that web page.  Thanks in advance!
-Ali
Title: Re: cURL help: need to get page with varying date
Post by: Lemonilla on June 14, 2012, 08:08:46 PM
Is it possable you could give us the site? I don't know of any site that uses % in the url >.< but I believe all you would have to do is make a file that says:
Code: [Select]
start "~\iexplore.exe" "yourURLHere"
But I will be unable to test this until I find a site, sorry.
Title: Re: cURL help: need to get page with varying date
Post by: BC_Programmer on June 14, 2012, 08:33:33 PM
I don't know of any site that uses % in the url >.<
% signs in a URL are used for escaping certain characters. In the given URL, for example, %2F is character code 47 which is the forward slash ("/"). naturally that cannot appear as is since it would be another slash and "break" the url.

This is also part of the problem in the original post. the date is being represented as 6/13/2012, but with the slashes escaped. I guess the problem here is that the % signs have special meaning on the windows command line.

You can escape them by inserting a caret before the percent sign.

Quote
https://site.gov/blah/blah/decision?process_date=6^%2F13^%2F2012^&v_dispatchid=#######^&but=Reports
(ampersands have special meaning too, so those need to be escaped).

For getting the proper URL for the previous date, you can probably do some string processing on the output from date /t; though it would likely rely on the date format being used.

Title: Re: cURL help: need to get page with varying date
Post by: Salmon Trout on June 14, 2012, 11:48:21 PM
I guess the problem here is that the % signs have special meaning on the windows command line. You can escape them by inserting a caret before the percent sign.

The escape for a percent sign is another percent sign. Thus to achieve % you need %%. (Why don't people just use VBScript?)