help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] NetClients.HTTP


From: Stephen
Subject: [Help-smalltalk] NetClients.HTTP
Date: Tue, 29 Mar 2011 08:52:13 +1300
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

Hi all,

I wish to monitor a web site with a script so I know if it goes down.

I hunted around in the source in packages/net, and got this to work to an onsite web server...

#!/usr/local/bin/gst -f
  PackageLoader fileInPackage: 'NetClients'.
  siteurl := 'http://localhost/index.html'.
request := NetClients.URIResolver openStreamOn: siteurl ifFail: [ Transcript show: 'Request failed'].
  Transcript show: request contents.

Now the host to be monitored is a Moodle server, but when I use the same code with the URL of the Moodle server I get an error. For instance, with code above and the siteurl below:-

siteurl := 'http://moodle.org/'.   "moodle.org shows same error as our site"

this is the output...
Request failedObject: TextCollector new "<0x40372180>" error: method is responsibility of a subclass SystemExceptions.SubclassResponsibility(Exception)>>signal (ExcHandling.st:254) SystemExceptions.SubclassResponsibility class(Exception class)>>signal (ExcHandling.st:151)
TextCollector(Object)>>subclassResponsibility (Object.st:1365)
TextCollector(Stream)>>atEnd (Stream.st:324)
TextCollector(Stream)>>nextPutAllOn: (Stream.st:308)
TextCollector(Stream)>>upToEnd (Stream.st:203)
TextCollector(Stream)>>contents (Stream.st:192)
UndefinedObject>>executeStatements (sitemonitor.st:10)

Help to get the body of the http response from moodle.org would be much appreciated.

Thanks
Stephen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]