开发者

phpQuery - make php script wait until iframe content has loaded

I'm using the phpQuery library (http://code.google.com/p/phpquery/) to parse web pages but have stumbled across a problem getting sites that use Ajax to display all the content.

I have worked out that I can get all the content if I load it in to an iframe (the code below works):

$temp = phpQuery::newDocumentHTML('<iframe src="" id="test">a</iframe>')->find('iframe[id=test]')->attr('src', 'http://www.example.com/');
echo $temp;

BUT, my question is, how can I get my PHP script to wait u开发者_如何学Gontil the iframe has loaded before proceeding?

Below is the jQuery equivalent but I was wondering if anybody knows how to do the equivalent using phpQuery?

$(iFrame).attr('src', 'http://www.example.com');
$(iFrame).load(function(){
    alert("Loaded");
});

Thanks in advance.


BUT, my question is, how can I get my PHP script to wait until the iframe has loaded before proceeding?

This is not how PHP-side HTML parsing works. phpQuery just parses the HTML code, it doesn't do anything with it - like load and/or render iframes, or run JavaScript events.

There is probably a way to do what you want to do - if you tell us what that is!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜