Skip to content

Instantly share code, notes, and snippets.

<project name="urlping" default="urlping" basedir=".">
<target name="urlping">
<get src="http://pshmn.com/eaFnY" dest="./~pushmon.tmp" />
</target>
</project>
@pushmon
pushmon / gist:1886414
Created February 22, 2012 18:11
Python
import urllib2
urlString = 'http://pshmn.com/eaFnY'
try:
handle = urllib2.urlopen(urlString)
handle.read()
handle.close()
except IOError:
print "log error"
@pushmon
pushmon / gist:1886329
Last active September 25, 2018 08:36
Java
package com.teamextension.ping;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class UrlPing {
public static void main(String[] args) {
String urlString = "http://pshmn.com/eaFnY";
pingUrl(urlString);
@pushmon
pushmon / gist:1886321
Created February 22, 2012 17:57
Perl
#!/usr/bin/perl
use LWP::Simple;
my $urlString = 'http://pshmn.com/eaFnY';
my $content = get $urlString;
die 'log error' unless defined $content;
<?php
$urlString = 'http://pshmn.com/eaFnY';
$handle = @fopen($urlString, 'r');
if (!$handle) {
// log error
}
@fclose($handle);
?>
using System;
using System.Net;
namespace TeamEXtension
{
public class UrlPing
{
public static void Main(string[] args)
{
string urlString = "http://pshmn.com/eaFnY";
@pushmon
pushmon / gist:1886151
Created February 22, 2012 17:18
AutoIt
Dim $urlString = "http://pshmn.com/eaFnY";
InetGet($urlString, "~ping.tmp")
If @error <> 0 Then
; log error
EndIf
@pushmon
pushmon / gist:1886142
Last active June 18, 2018 17:26
Batch File
rem
rem Please download curl from https://curl.haxx.se/download.html and add it to your path.
rem
@echo on
rem if command fails, exit and do not ping
if %errorlevel% neq 0 goto ERROR
set URL_STRING=http://pshmn.com/eaFnY
curl %URL_STRING%