file_get_contents():流不支持查找PHP

file_get_contents():流不支持查找PHP

问题描述:

我正在尝试使用file_get_contents()仅从假名称生成器网站中获取名称( https://fakena.me/fake-name/),但是我收到以下警告:

I'm trying to use file_get_contents() to grab only Name from fake name generator site(https://fakena.me/fake-name/), however I'm getting the following warning:

file_get_contents() stream does not support seeking 

我不需要页面的全部内容.我只需要在此站点中的名称"部分: https://fakena.me/fake-name/ .


我的代码:

I dont need entire content of the page. I need only Name section in this site: https://fakena.me/fake-name/.


My code:

$name= file_get_contents('https://fakena.me/fake-name/', NULL, NULL, 849, 32);

它在localhost中运行良好,仅在实时网站中显示错误.

Its working well in localhost, showing error only in live website.