http:\/\/embed.(.*).com\/\?id=([0-9]+)
$userAgent = array('http' => array('user_agent' => 'Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D)'));
is there anyway to get both http and https with the above code?
http:\/\/embed.(.*).com\/\?id=([0-9]+)
$userAgent = array('http' => array('user_agent' => 'Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D)'));
is there anyway to get both http and https with the above code?
Add an optional pattern s?
(s
will match an s
and ?
will make the regex engine match it one or zero times):
https?:\/\/embed\.(.*)\.com\/\?id=([0-9]+)
^^
I also think you forgot to escape the dots after embed
and before com
. You also might want to replace (.*)
with ([^\/]*)
to avoid overflowing across /
separated URL sections, so consider using
https?:\/\/embed\.([^\/]*)\.com\/\?id=([0-9]+)