note 100318 added to function.preg-match
| From: | gfabricio at gmail dot com | Date: | Thu, 07 Oct 2010 19:25:07 +0000 |
| Subject: | note 100318 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173062@lists.php.net to get a copy of this message | ||
//Function to validate youtube urls:
function youtubeValidator($url)
{
if(preg_match('/youtube.com\\/watch\\?.*v=.*$/',$url))
{
preg_match('/(?<=\\?v=)[^&]*/',$url,$matches,PREG_OFFSET_CAPTURE);
//$chk = curl_init("http://youtube.com/v/{$matches[0][0]}");
//curl_exec($chk);
//$i = curl_getinfo($chk);
$youtube = "http://youtube.com/v/{$matches[0][0]}";
return $youtube;
}
return false;
}
----
Server IP: 189.126.97.120
Probable Submitter: 189.19.254.119
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- https://master.php.net/note/edit/100318
Del: integrated -- https://master.php.net/note/delete/100318/integrated
Del: useless -- https://master.php.net/note/delete/100318/useless
Del: bad code -- https://master.php.net/note/delete/100318/bad+code
Del: spam -- https://master.php.net/note/delete/100318/spam
Del: non-english -- https://master.php.net/note/delete/100318/non-english
Del: in docs -- https://master.php.net/note/delete/100318/in+docs
Del: other reasons-- https://master.php.net/note/delete/100318
Reject -- https://master.php.net/note/reject/100318
Search -- https://master.php.net/manage/user-notes.php