note 84618 modified in function.exec by felipe

From: Date: Tue, 22 Jul 2008 11:54:57 +0000
Subject: note 84618 modified in function.exec by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142486@lists.php.net to get a copy of this message
<?php public function executeUrl() { $website = $this->getRequestParameter("Url"); $p = parse_url($website); $scheme = parse_url($p['scheme']); //if ($scheme != 'http' || $scheme != 'HTTP' || $scheme != 'https' || $scheme != 'HTTPS') if($scheme =='') { $Url = 'http://'+$Url; } $t = "has address"; $host = "host ".$Url; $res = exec($host); $pos = (strpos($res,$t)); if($pos !== false) { $correct = true; echo "true|X|$Url"; } else { $correct = false; echo "false|X|$Url"; } return sfView::NONE; } } ?> I want to make the code work properly as i need to check for a valid domain name, this is done through Ajax and problem in code is with the code above as the code is not giving a proper output. please help me regarding the same.... --was-- public function executeUrl() { $website = $this->getRequestParameter("Url"); $p = parse_url($website); $scheme = parse_url($p['scheme']); //if ($scheme != 'http' || $scheme != 'HTTP' || $scheme != 'https' || $scheme != 'HTTPS') if($scheme =='') { $Url = 'http://'+$Url; } $t = "has address"; $host = "host ".$Url; $res = exec($host); $pos = (strpos($res,$t)); if($pos !== false) { $correct = true; echo "true|X|$Url"; } else { $correct = false; echo "false|X|$Url"; } return sfView::NONE; } } I want to make the code work properly as i need to check for a valid domain name, this is done through Ajax and problem in code is with the code above as the code is not giving a proper output. please help me regarding the same.... http://php.net/manual/en/function.exec.php

« previous php.notes (#142486) next »