Check the authenticity of given link and store it in a mysql table using php -


how check if user given link link belonging particular website or not? using php. should use preg or there function it? can check if link broken or not? there function it? how can make sure delete malacious links or not possible handle automatically? should following function? $link=mysql_real_escape_string($_get['link']);

always use get_headers, helps validate state of website, if available or not.

$val = @get_headers("http://www.google.com");
print_r($val[0]);

use following preg_match pattern check broken link.

%^((https?://)|(www.))([a-z0-9-].?)+(:[0-9]+)?(/.*)?$%i


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -