2016-06-13 4 views
-1

私は、PHPでのリダイレクタとして動画をgoogle.docsリッピングし(DOCの現在のプレイヤーがフラッシュにあるので)サブドメイン/ドメインを変更しますか?

は、私がこれまで持っていることは良い作品videojsプレーヤーでそれらを置くためにプロジェクトに取り組んでいますが、それはリッピングredirector.googlevideo.com/この

https://redirector.googlevideo.com/videoplayback?requiressl=yes&id=a8fa0f1624209c52&itag=22&source=webdrive&app=texmex&ip=2604:5800:0:35:250:56ff:fe9e:85f5&ipbits=32

ようにそれの後にすべてを保つ:そう

https://r8---sn-vgqs7n7k.c.docs.google.com/videoplayback?requiressl=yes&id=a8fa0f1624209c52&itag=22&source=webdrive&app=texmex&ip=2604:5800:0:35:250:56ff:fe9e:85f5&ipbits=32

私はhttpsでドメイン全体/サブドメインを置き換えるためにPHPを使用するようにリンクアウト

私は現在、リンクからunicodeを置き換えるのに次の行を使用していますが、最初のドメイン行を置き換える方法はわかりません。何か案は?

$ links = str_replace(配列( '\ u003d'、 '\ u0026')、配列( '='、 '&')、$ cat [1]);

答えて

0

私は、これがhttpsの間にある文字列の一部置き換えますpreg_replaceを使用したい://と最初のスラッシュ:

$link = 'https://r8---sn-vgqs7n7k.c.docs.google.com/videoplayback?requiressl=yes&id=a8fa0f1624209c52&itag=22&source=webdrive&app=texmex&ip=2604:5800:0:35:250:56ff:fe9e:85f5&ipbits=32'; 

$link = preg_replace('#https://[^/]+#', 'https://redirector.googlevideo.com', $link); 
echo $link; 

出力:

https://redirector.googlevideo.com/videoplayback?requiressl=yes&id=a8fa0f1624209c52&itag=22&source=webdrive&app=texmex&ip=2604:5800:0:35:250:56ff:fe9e:85f5&ipbits=32 

説明:

#   : regex delimiter 
    https:// : literally https:// 
    [^/]+  : one or more character that is not a slash 
#   : regex delimiter 
関連する問題