如何使用PHP从html中提取数据

时间:2022-10-29 13:29:13

I am trying to get data(like job vacancy) from page like http://www.quest.edu.pk/jobs/.I dont know how to get this.can anyone help me in doing this. Thanku in advance.

我试图从http://www.quest.edu.pk/jobs/这样的页面获取数据(如职位空缺)。我不知道如何得到这个。任何人都可以帮助我这样做。提前谢谢。

1 个解决方案

#1


php has inbuilt function file_get_contents to extract complete html source of webpage - like below:

php有内置函数file_get_contents来提取完整​​的html网页源 - 如下所示:

$html=file_get_contents("http://www.quest.edu.pk/jobs/")

But its not recommended because we can not set timeout parameter in function. So instead of this you can use curl library and preg_match as suggested by @Sunil Pachlangia & @Noman.

但它不推荐,因为我们无法在函数中设置超时参数。因此,您可以使用@Sunil Pachlangia和@Noman建议的curl库和preg_match。

you can refer this Link for more information.

您可以参考此链接以获取更多信息。

#1


php has inbuilt function file_get_contents to extract complete html source of webpage - like below:

php有内置函数file_get_contents来提取完整​​的html网页源 - 如下所示:

$html=file_get_contents("http://www.quest.edu.pk/jobs/")

But its not recommended because we can not set timeout parameter in function. So instead of this you can use curl library and preg_match as suggested by @Sunil Pachlangia & @Noman.

但它不推荐,因为我们无法在函数中设置超时参数。因此,您可以使用@Sunil Pachlangia和@Noman建议的curl库和preg_match。

you can refer this Link for more information.

您可以参考此链接以获取更多信息。