如何使用Ajax的网站的file_get_contents如何使用、网站、Ajax、file_get_contents

2023-09-10 17:52:14 作者:女人不能宠越宠越有种

在使用 file_gets_contents($网站)或 卷曲 加载网站,它加载整个网站?我主要是关于使用感兴趣的卷曲

我用它来加载一个网页,然后使用AJAX得到了一些内容,如价格,它有一些问题,得到的价格。

I am using it to load a webpage that then gets some contents such as price using AJAX and it has some problems getting the prices.

当我使用的file_get_contents,它为常作为一个整体的网站做的浏览器加上使用Ajax加载的东西装入?

When I use file_get_contents, does it load as normally as a whole website does on a browser plus the stuff loaded using Ajax?

推荐答案

没有。使用的file_get_contents()只会返回页面内容,也不会在页面本身上执行任何JavaScript。这种行为的模拟几乎等同于查看页面源代码在浏览器中。

No. Using file_get_contents() will only return the page contents, it will not execute any JavaScript on the page itself. The analog of this behaviour is almost equivalent to "View Page Source" in a browser.