Вопрос

I use snoopy to get a URL : A.com , but in A.com has a simple javascript to redirect request to B.com automaticly.
The javascript just like below

document.write('<input style="display:none" type="button" id="exe" value="" onclick="window.location=\'B.com\'">');document.getElementById('exe').click();

When I use snoopy I only get A.com html showing the javascript above. Question is how to get B.com html with perform the javascript using snoopy?

Это было полезно?

Решение

I'm not directly familiar with the snoopy library, but since the code on page A.com isn't a standard type of http redirect, you won't be able to do what you are asking without manually parsing the result of a.com as you suggested.

A.com can have arbitrary code, so the only way to "follow" to page B would be to run the javascript, but even that is messy since you don't know what A.com's code will do before running it.

Другие советы

you can use

include "Snoopy.class.php";<br>
$snoopy = new Snoopy;<br>
$snoopy->maxredirs = 2;<br>
$snoopy->fetchtext("http://www.A.com");<br>
print $snoopy->results;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top