I want to get the link by applying preg_match in php here is my code
$string = playlist: [{
image: "http://77.81.98.55/i/01/00012/d6ntku2p3tnn.jpg",
provider: "http://static.vidzi.tv/nplayer/vidzi.swf",
sources: [{
file: "http://vidzi.tv/6c90fqha0k9i-4b4a926f75863405c12bfaeb331b331c.m3u8?embed=",
type: 'hls'
},{
file: "http://77.81.98.55/gzuqiu4h342qedz7nknr5h3sli74im5vv7f2ae7z2pxjxhqnqxk4625rsdpq/v.mp4"
}]
,tracks: [{file: "http://vidzi.tv/6c90fqha0k9i-4b4a926f75863405c12bfaeb331b331c.vtt", kind: "thumbnails"}]
}]
preg_match('/file: "(.*?)",/i', $result, $dl_link);
echo '<pre>';
print_r($dl_link);
echo '</pre>';
And the output is
Array
(
[0] => file: "http://vidzi.tv/6c90fqha0k9i-4b4a926f75863405c12bfaeb331b331c.m3u8?embed=",
[1] => http://vidzi.tv/6c90fqha0k9i-4b4a926f75863405c12bfaeb331b331c.m3u8?embed=
)
From above preg_match i get first
file: "http://vidzi.tv/6c90fqha0k9i-4b4a926f75863405c12bfaeb331b331c.m3u8?embed="
but i want to get this
file: "http://77.81.98.55/gzuqiu4h342qedz7nknr5h3sli74im5vv7f2ae7z2pxjxhqnqxk4625rsdpq/v.mp4"
help me thanks
Since this appears to be broken JSON
string you can use this regex:
preg_match_all('/file:\h*"([^"]*)"/i', $string, $m);
print_r($m[1][1]);
//=> http://77.81.98.55/gzuqiu4h342qedz7nknr5h3sli74im5vv7f2ae7z2pxjxhqnqxk4625rsdpq/v.mp4
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments