php jika url berisi
if(strpos($_SERVER['REQUEST_URI'], "string")) {
...
}
RedBredren
if(strpos($_SERVER['REQUEST_URI'], "string")) {
...
}
$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (!strpos($url,'mysql')) {
echo 'No mysql.'; //swapped with other echo statement
} else {
echo 'Mysql exists.';
}
function urlExists($url=NULL)
{
if($url == NULL) return false;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode>=200 && $httpcode<300){
return true;
} else {
return false;
}
}
preg_match('/(http|ftp|mailto)/', $string, $matches);
var_dump($matches);
if (strpos($_SERVER['REQUEST_URI'], "url word") !== false){
// code
}