02-23-2012 02:03 PM
I'm trying to use URL to open an encrypted hyperlink that has two periods at the end of the URL. The Two periods are necessary for the program on the web server. It appears that SAS does not recognize the two periods that are in my URL because when I click on the URL Link in my SAS log, the URL that shows in the browser does not have any periods on the end.
Does anyone have any suggestions here?
02-23-2012 02:34 PM
I replaced our proprietary loations with the words DUMMY_URL and DUMMY.
INFILE JUNK LENGTH=LEN;
INPUT RECORD $VARYING8192. LEN;
PUT RECORD $VARYING8192. LEN;
The .. at the END Of the URL is part of the encryption schema that our web server uses. When I paste the real URL into my browser with the .. at the end, it works, when I leave the .. off, it gives a 403 Error. When I look at this in my SAS log (and in the SAS program) when you click on the link, it opens a browser without the .. on the end and the result is a 403 Error.
Here is an example of the same type of program that actually does work:
filename fetch url
infile fetch length=len;
input record $varying8192. len;
PROC PRINT DATA=PGCNT;
This is the output of the program that does work:
NOTE: >>> GET http://www.textfiles.com/100/actung.hum HTTP/1.0
NOTE: >>> Accept: */*.
NOTE: >>> Accept-Language: en
NOTE: >>> Accept-Charset: iso-8859-1,*,utf-8
NOTE: >>> User-Agent: SAS/URL
NOTE: <<< HTTP/1.1 200 OK
NOTE: <<< Date: Thu, 23 Feb 2012 19:33:10 GMT.
NOTE: <<< Server: Apache/1.3.42 (Unix).
NOTE: <<< Last-Modified: Sun, 01 Aug 1999 17:20:50 GMT.
DATA READ IN FROM THE WEB PAGE:
3 Das machine is nicht fur gerfingerpoken und mittengrabben.
4 Ist easy schnappen der Sprinngwerk, blowenfusen und
5 . poppencorken mit spitzensparken.
6 Ist nicht fur gewerken by das Dummkopfen. Das rubbernecken
7 . sightseeren keepen hands in das Pockets.
8 . Relaxen und watch das blinkenlights...
********************* Bottom of Data ******************************
I am running SAS 9.2 on IBM Mainframe running ZOS.
Any help here is appreciated, thanks,
02-24-2012 02:08 PM
Can you provide a slightly more accurate protrail of the part you call ENCRYPTEDURL..
Where does this value come from? Is it hardcoded as in your example?
Toms' suggesstion about replacing each period with %2E (urlencoded period) really should provide the desired results if it is the only issue, so I suspect you may have other invalid URL charaters somewhere.
You can try something like the following:
02-24-2012 08:02 AM
I just did, it does not work on PC SAS or on the Mainframe. I still get a 403 forbidden error. The URL does work when I paste it into a browser with 2 %2E's at the end.
02-24-2012 01:50 PM
I don't use URL data so this is just a shot in the dark. Have you tested it with the URL in double quotes instead of single?
It shouldn't make a difference but sometimes...
02-24-2012 03:09 PM
Does it work from PC and not from Mainframe? Not from SAS at all?
Are you sure your website isn't using some super secret authenication method that SAS doesn't support?
02-24-2012 03:15 PM
It fails to work on Mainframe SAS and PC SAS. Have tried using Single Quotes, Double Quotes, replacing periods with %2E, have tried concatenating the URL with the two periods. I can read in any normal web page URL and write out the contents to a file (which is what any SAS Web-crawler program does), but I cannot for the life of me figure out how to get this URL to work from SAS.
I appreciate all the suggestions. I've gone back to the developers that own the web server and asked for a different URL, and I have also asked if they can dump the data to a text file that's in a mainframe data set that I have access to. I can manually download the data and upload it to the mainframe until I find a work around.
Regarding the authentication, I tried passing USER ID and Password parameters, and that still gave me a 403 error.
I'm sure we'll find a way to get this working one way or another. In the meantime, I'll do the manual work around.
02-24-2012 03:37 PM
I Googled it, did not find any, I'm checking with our Web guys to see if they can give a URL that's formatted that way that does not return confidential data.
02-24-2012 03:39 PM
I asked because, according to the standard, I don't think they are allowed see: http://www.faqs.org/rfcs/rfc2396.html
02-24-2012 04:07 PM
It may not follow a proper standard but it is totally valid, here is a public link you can test and see that a URL ending with a '..' will work, even unencoded, and be picked up by the webserver.
blah.. isn't defined yet.
And to confirm SAS can work with this:
filename blah url 'http://www.urbandictionary.com/define.php?term=blah..' debug lrecl=1000;
infile blah length=len;
input line $varying1000. len;
if prxmatch('/<i>blah../',line)>0 then put _n_= line=;
_N_=91 line=<i>blah..</i> isn't defined <a href="/add.php?word=blah..">yet</a>.
02-24-2012 04:10 PM
That URL is blocked by our IT policy at work, I'll try it on my home computer later. Thanks for the URL!