如何使用PHP获取由javascript修改的另一个页面的元素内容

时间:2018-07-03 11:23:02

标签: javascript php jquery html dom

我想使用PHP通过另一个外部页面(http://www.abcd.com/a1.html)的ID提取跨度内容。但不幸的是,span元素最初是空的,并被该页面的javascript修改。如果我使用file_get_contents函数并grep跨度ID的内容,由于内容是由ajax脚本填充的,因此我只会得到空字符串。

<!--   http://www.abcd.com/a1.html  -->
....
<div>This span content is:<span id="spanid"></span></div>
....

<script type="text/javascript">
     jQuery.ajax({
           type: "GET",
           cache: false,
           async: false,
               .....

           ret_val = ...  ;
           jQuery("#spanid").html(ret_val);

      });
</script>

有没有办法让我可以使用PHP从一组网页中提取每个页面的“ spanid”内容,这些网页例如http://www.abcd.com/a1.htmlhttp://www.abcd.com/a2.htmlhttp://www.abcd.com/a3.htmlhttp://www.abcd.com/a4.html吗?

0 个答案:

没有答案