file_get_contents with spaces in URL

前端 未结 2 1120
渐次进展
渐次进展 2021-01-12 04:02

I have an issue where even if I replace the spaces to %20 and get this content the ultimate url the browser gets turns the \"%20\" into \"%2520\"

Here\'s my code, an

2条回答
  •  耶瑟儿~
    2021-01-12 04:51

    $song = $_GET['song']);
    
    $url = "http://www.lyrdb.com/lookup.php?for=fullt&q=";
    
    echo "list url is " . htmlentities($url . $song) . "
    "; $content = file_get_contents($url . urlencode($song)); echo $content;

提交回复
热议问题