ohdang888 Posted July 15, 2008 Share Posted July 15, 2008 i want to take the url, for example http://www.youtube.com/watch?v=j4HKdf6hzzLS, and just get the VIDEO ID from the submitted url... i'm getting this error: Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /home/ky4obama/public_html/fb_app/video_submitting.php on line 9 <?php $post_url = mysql_real_escape_string(trim($_POST['url'])); if (preg_match('youtube.com/watch?v=(?<video>\w+)', $post_url, $url)) { echo "WIDTH = ".$url['video']; }else{ echo "no url found"; ?> Link to comment https://forums.phpfreaks.com/topic/114855-solved-preg-match/ Share on other sites More sharing options...
JD* Posted July 15, 2008 Share Posted July 15, 2008 Why not just use strstr? $video = strstr($post_url, "?v="); Link to comment https://forums.phpfreaks.com/topic/114855-solved-preg-match/#findComment-590624 Share on other sites More sharing options...
ohdang888 Posted July 15, 2008 Author Share Posted July 15, 2008 $post_url = "http://youtube.com/watch?v=7SK_Ps_Jfeg"; $video = strstr($post_url, "v="); echo $video; its not coming up with anything, no video and no errors... hm....any thoughts? Link to comment https://forums.phpfreaks.com/topic/114855-solved-preg-match/#findComment-590631 Share on other sites More sharing options...
ohdang888 Posted July 15, 2008 Author Share Posted July 15, 2008 nvm, it was an isset error... thanks Link to comment https://forums.phpfreaks.com/topic/114855-solved-preg-match/#findComment-590632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.