Operating System - OpenVMS
1753720 Members
5070 Online
108799 Solutions
New Discussion юеВ

Checking a URL from OpenVMS

 
SOLVED
Go to solution
David B Sneddon
Honored Contributor

Re: Checking a URL from OpenVMS

I have tried the above URL in a browser and get
a timeout. I have also tried the above URL with cURL,
with it quoted and unquoted and get a timeout in both cases...

$ curl -v "http://ila.educ.gov.bc.ca/dev60cgi/rwcgi60?ila&report=DoNotDelete.rep&destype=cache&desformat=HTML"
$ curl -v http://ila.educ.gov.bc.ca/dev60cgi/rwcgi60?ila&report=DoNotDelete.rep&destype=cache&desformat=HTML


Dave
David B Sneddon
Honored Contributor

Re: Checking a URL from OpenVMS

...and the output was

* About to connect() to ila.educ.gov.bc.ca port 80
* Trying 142.36.182.246... connection timed out
* couldn't connect to host
* Closing connection #0


Dave
Steven Schweda
Honored Contributor

Re: Checking a URL from OpenVMS

> [...] and get a timeout. [...]

Well, of course. You didn't think that this
fellow's Oracle data base would be generally
accessible, did you? (He keeps his cURL
command a secret, so this should not be
amazing.)

I'm still betting on argument quotation (but
for case preservation, as the ampersands
appear to be harmless here, contrary to my
initial fear).

As usual, a straight answer to a simple
question might reduce the guesswork.

Note that Wget _will_ preserve command-line
case with SET PROCESS /PARSE_STYLE = EXTENDED
(assuming a sufficiently modern C RTL).

Judging from the results I got from a:

curl 7.15.1 (ALPHA-HP-VMS) libcurl/7.15.1 OpenSSL/0.9.6g

trying 'curl -V' and 'curl "-V"', I'd guess
that argument quotation is important with
cURL. Or (again trusting the C RTL), first
DEFINE DECC$ARGV_PARSE_STYLE ENABLE.

For details:
HELP CRTL Feature_Logical_Names

For details on how Wget does it
automatically, see:

HELP CRTL decc$feature*

and/or, look at its VMS-specific source code.
Joseph Huber_1
Honored Contributor

Re: Checking a URL from OpenVMS

BTW, the original question was to check if an URL is available:

To avoid downloading the URL, just get the header with "pipe curl --head url >head.tmp".

Then one can use $STATUS to check if the server is reachable at all. If success, then one could parse the output for the HTTP status response like
("HTTP/1.1 200 Sending Processed HTMLX"). Code 200 is the HTTP success.
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: Checking a URL from OpenVMS

And, for Perl lovers :-)

at ftp://ftp.multicians.org/

there is (amongst others) url.pl, and urltest.pl, it works like this

perl URLTEST.PL http://www.multicians.org

http://www.multicians.org ok HTTP/1.1 200 OK

urltest could be modified to return VMS $status for use inside DCL procedures.
http://www.mpp.mpg.de/~huber
Martin Vorlaender
Honored Contributor

Re: Checking a URL from OpenVMS

Sepp,

just a few notes...

>>>
To avoid downloading the URL, just get the header
<<<

BTW: Lynx also has a -head option.

>>>
And, for Perl lovers :-)
<<<

All perl programmers doing serious web programming install the libwwwperl (or LWP) which comes with some ready-made example programs including GET, HEAD, and POST.

cu,
Martin
Joseph Huber_1
Honored Contributor

Re: Checking a URL from OpenVMS

Ah fine, yes i see LWP in my perl installation.

Just saw urltest immediately when looking for something containing URL :-)

And before I (with my minimal experience) write something using the LWP package I ready use urltest like this:

$ pipe perl perl_root:[utils]urltest.pl "url to test" |-
(read sys$pipe line ; line=f$element(0," ",line) ; -
define/job http_code &line)
$ if f$trnlnm("HTTP_CODE").eqs."ok" ...
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: Checking a URL from OpenVMS

I tried a similar one-liner with "lynx -head" and "curl --head", but these utilities apparently open stdout in a certain way, so that sys$pipe delivers one character per read:
not very convenient.

So without Perl (URL or LWP), one has to do it using lynx or curl by redirecting output to a temporary file, read the first line, check the second word of the line for the httpd response.

http://www.mpp.mpg.de/~huber
Martin Vorlaender
Honored Contributor

Re: Checking a URL from OpenVMS

>>>
And before I (with my minimal experience) write something using the LWP package...
<<<

That's why I refered to the example programs - you don't need to do anything with them:

$ perl perl_root:[utils]lwp-request. -m HEAD http://www.openvms.de/
200 OK
Connection: close
Date: Thu, 01 Jun 2006 13:00:04 GMT
Accept-Ranges: bytes
ETag: "c4769c-f84-3fe30791"
Server: Apache/1.3.26 (OpenVMS) mod_jk/1.2.3-dev PHP/4.3.2 mod_perl/1.25 mod_ssl/2.8.10 OpenSSL/0.9.6g
Content-Length: 3972
Content-Type: text/html
Last-Modified: Fri, 19 Dec 2003 14:13:37 GMT
Client-Date: Thu, 01 Jun 2006 13:00:04 GMT
Client-Peer: 195.137.216.132:80
Client-Response-Num: 1
$

cu,
Martin
Joseph Huber_1
Honored Contributor

Re: Checking a URL from OpenVMS

Thanks martin, so finally another one liner:

$ pipe perl perl_root:[utils]lwp-request. -m HEAD "testURL" | -
(read sys$pipe line ; line = f$element(0," ",line) ; define/job http_code &line)
$ if f$trnlnm("HTTP_CODE").eq.200 !success ...
http://www.mpp.mpg.de/~huber