file_get_contents在url上没有使用hashtag符号

时间:2016-02-22 12:49:40

标签: php parsing file-get-contents

我有要解析的网址:

http://www.ntvplus.ru/tv/#genre=all&channel=3385&channel=3384&channel=3416&date=22.02.2016&date=23.02.2016&date=24.02.2016&date=25.02.2016&time=day

我尝试使用file_get_contents和CURL,但它们似乎都只向http://www.ntvplus.ru/tv/发送请求并忽略散列符号后的所有内容。 我试图逃避但仍然没有运气。 有人可以提供有效的解决方案吗?

1 个答案:

答案 0 :(得分:2)

#元素仅限客户端。他们不会被无头请求解析,例如file_get_contents()(甚至是cURL)。

正如@brevis在评论中建议的那样,你必须使用查询字符串版本:

$content = file_get_contents('http://www.ntvplus.ru/tv/?genre=all&channel=3385&channel=3384&channel=3416&date=22.02.2016&date=23.02.2016&date=24.02.2016&date=25.02.2016&time=day');