Reputation: 4263
I have a page that's loading another page in an iframe. The page being called does some stuff dynamically as it's called from my site, so I can't really just call it directly, and even if I could it'd be inefficient to call the same page and run that same dynamic code twice.
So what I'd like to do is once my page is done loading, scrape itself, parsing for some certain unique things, and then handle the parsed results. I know how to parse and handle the results of the parsing, however I'm not quite clear on how to do the self-scraping.
Anyone have any suggestions?
TiA
Upvotes: 1
Views: 263
Reputation: 4340
I must say, the whole idea of scraping your output being inefficient (specially when compared to parsing the rendered page) doesn't really sound right to me.
Still, if your problem is getting your output once the page is rendered, you can use the output buffering control functions:
ob_start();
render_your_page();
$rendered_page = ob_get_contents();
ob_end_flush(); // Sends page, turns off output buffering
scrape($rendered_page);
Edit: I hope I understood your question correctly. It's 5:20AM on Christmas day, and I'm ready for bed :)
Upvotes: 1
Reputation: 1388
Use AJAX to send the page output to a script, then parse it however you want. I don't really know what you mean by "scraping," and you really need to add more tags.
Upvotes: 1