使用 file_get_contents 从其他网站获取数据

Getting data from a different website using file_get_contents

http://leagueoflegends.wikia.com/wiki/V1.0.0.101?action=edit 这是我试图从中获取数据的网站。此数据可免费使用,不受版权保护。 这就是我现在所做的,但它似乎不起作用:

$leagueoflegendswebsite = file_get_contents($_POST['leagueoflegendswebsite']);
    $first_step = explode( '<textarea>' , $leagueoflegendswebsite );
    $second_step = explode("</textarea>" , $first_step[0] );
    echo $second_step[1];

例如,现在我想从这个网站获取冠军的名字,所以

{{ci|Sona|Sona, the Maven of the Strings}}


{{ci|Blitzcrank}}

将是娑娜和布里茨,有没有简单的方法来做到这一点?

$leagueOfLegendsWebsiteHtml = file_get_contents("http://leagueoflegends.wikia.com/wiki/V1.0.0.101?action=edit");

$matches = array();
preg_match_all('/{{ci\|([^\|||}]+)/', $leagueOfLegendsWebsiteHtml, $matches);

print_r($matches);

应该使用正则表达式获取名称。

结果是:

Array
(
    [0] => Array
        (
            [0] => {{ci|Sona
            [1] => {{ci|Sona
            [2] => {{ci|Blitzcrank
            [3] => {{ci|Fiddlesticks
            [4] => {{ci|Garen
            [5] => {{ci|Gragas
            [6] => {{ci|Jax
            [7] => {{ci|Karthus
            [8] => {{ci|Kennen
            [9] => {{ci|Kassadin
            [10] => {{ci|Katarina
            [11] => {{ci|Kog'Maw
            [12] => {{ci|Rammus
            [13] => {{ci|Shaco
            [14] => {{ci|Singed
            [15] => {{ci|Taric
            [16] => {{ci|Twitch
            [17] => {{ci|Vladimir
            [18] => {{ci|Zilean
            [19] => {{ci|Ebonmaw
        )

    [1] => Array
        (
            [0] => Sona
            [1] => Sona
            [2] => Blitzcrank
            [3] => Fiddlesticks
            [4] => Garen
            [5] => Gragas
            [6] => Jax
            [7] => Karthus
            [8] => Kennen
            [9] => Kassadin
            [10] => Katarina
            [11] => Kog'Maw
            [12] => Rammus
            [13] => Shaco
            [14] => Singed
            [15] => Taric
            [16] => Twitch
            [17] => Vladimir
            [18] => Zilean
            [19] => Ebonmaw
        )

)