How to check validity of an URL

How to check validity of an URL. 1. Using Regex if (ereg(“^(http|https|ftp)\://[a-zA-Z0-9\.-]+\.[a-zA-Z0-9]{1,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\._\?\,\’/\\\+&%\$#\=~-])*$”, $url)) { echo ‘URL Correct’; } else { echo ‘Bad URL’; } This will validate URL with http, https and ftp schema. 2. Using fsockopen $url = parse_url($url); $conn = fsockopen($url[‘host’], 80); if (!$conn) die(‘Cannot connect!’); fwrite($conn, “GET {$url[‘path’]} HTTP/1.0\r\nHost: {$url[‘host’]}\r\nConnection: close\r\n\r\n”); $header = fgets($conn); if (preg_match(‘|HTTP/\S+\s+[2-3]\d\d|i’, $header))…

Read More »

inLinks first impression review

First, I was registered user at text-link-ads.com (TLA). While I’m not very active using TLA, I do sometimes got emails from them. Mostly an announcement email regarding their new product. On Nov 20, I got the following email from TLA: Hello, we are excited to announce our newest publisher offering www.inLinks.com inLinks allows you to sell simple text link ads…

Read More »

How to fix MaxMind GeoIP dat file 404 Not Found?

Just a few minutes ago, one of my cron that fetch current GeoIP.dat.gz file from MaxMind resolve to 404 Not Found. The cron is running monthly to update its GeoIP database. Its an Apache2 mod_geoip. This was the cron message: /etc/cron.monthly/geoip: –04:42:22– http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz Resolving www.maxmind.com… 67.15.94.80 Connecting to www.maxmind.com|67.15.94.80|:80… connected. HTTP request sent, awaiting response… 301 Moved Permanently Location: http://64.246.48.99/download/geoip/database/GeoIP.dat.gz…

Read More »