Inside my posts videos have code below:
[videojs mp4=\"http://www.example.com/video-play.mp4?contentId=7c6255ca14e901d2\" poster=\"https://2.bp.example.com/-
In PHP, try use regular expression. You may have to adjust the regex if your sample does not always follow this format.
$re = '/\[videojs mp4=\"(.*contentId=(.*?))\"/';
$str = '[videojs mp4="http://www.blogger.com/video-play.mp4?contentId=7c6255ca14e901d2" poster="https://2.bp.blogspot.com/-lSTjYuDBiAQ/VvST8Z7z2OI/AAAAAAAAGPY/c8yAE675bLEMYI-OMwtauCiXeu1yZPZaw/s1600/fundososvideos.jpg" preload="none" controls="controls" width="100%" height="400"]';
preg_match_all($re, $str, $matches);
// Print the entire match result
print_r($matches);
And above result are supposed to be
Array
(
[0] => Array
(
[0] => [videojs mp4="http://www.blogger.com/video-play.mp4?contentId=7c6255ca14e901d2"
)
[1] => Array
(
[0] => http://www.blogger.com/video-play.mp4?contentId=7c6255ca14e901d2
)
[2] => Array
(
[0] => 7c6255ca14e901d2
)
)
Its an assumption that you get the whole [videojs mp4="uri" ---...] as string. Now, you wants to process it and assign it to several different variables for future use.
$video_string = '[videojs mp4="http://www.blogger.com/video-play.mp4?contentId=7c6255ca14e901d2" poster="https://2.bp.blogspot.com/-lSTjYuDBiAQ/VvST8Z7z2OI/AAAAAAAAGPY/c8yAE675bLEMYI-OMwtauCiXeu1yZPZaw/s1600/fundososvideos.jpg" preload="none" controls="controls" width="100%" height="400"]';
if (preg_match('/mp4="(.*)"\sposter/', $video_string, $matches1)) {
$url = $matches1[1];
$id = explode('=',parse_url($url)['query'])[1];
echo 'From Video string I get Id= '.$id . ' & url = '.$url;
}