php - finding javascript errors from external page, output results to file -
i have been tasked created script performing health checks on web page,
for part can information need using curl , couple of other tools.
so set up.
i have php class on server a, cron job on server executes php script begins health check loading page on server b, using curl can timeout information, response codes etc, stuck when comes discovering if given web page has javascript errors (that appear in console); , appreciate give.
is there way make api call via php contact page on server b, load page, load error console entries text file?
these details available via browser, browser generates these errors or can use script fool script thinking browser , grab errors?
i help!
thank you.
in javascript can use phantom.js read console message.
var webpage = require('webpage'); var page = webpage.create(); page.onconsolemessage = function(msg, linenum, sourceid) { console.log('console: ' + msg + ' (from line #' + linenum + ' in "' + sourceid + '")'); };
source : http://phantomjs.org/api/webpage/handler/on-console-message.html
Comments
Post a Comment