flashservice.xvideos com国外官网.com

- Database Error
Database Error
已经将此出错信息详细记录, 由此给您带来的访问不便我们深感歉意php - How do I get the id from the following embed link using pregmatch - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
Ok if I have this url:
&iframe width="510" height="400" src="/xembed.php?video=XXXXXX" frameborder="0" scrolling="no"&&/iframe&
I can get the video id with
preg_match('/video=([a-zA-Z0-9]+)/', $url, $url_data);
how do I do the same with this url:
&iframe src="/embedframe/XXXXX" frameborder=0 width=510 height=400 scrolling=no&&/iframe&
XXXX is the id
I’m really not sure what im doing with regular expressions
Take a look at the string you are trying to capture and notice the difference.
The first has ?video=.
The second one has a different structure.
Try something like this:
preg_match('/embedframe\/([a-zA-Z0-9]+)/', $url, $url_data);
2,06541125
preg_match('/src=".*\/([a-zA-Z0-9]+)"/', $url, $url_data);
Or since src could be in caps, add case insensitive:
preg_match('/src=".*\/([a-zA-Z0-9]+)"/i', $url, $url_data);
Another improvement would be to avoid overly greedy matches where other attribute fields in the url might have the "/" character, modify to this:
preg_match('/src=".*?\/([a-zA-Z0-9]+)"/i', $url, $url_data);
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled

我要回帖

更多关于 xvideos com 官网 的文章

 

随机推荐