1
我动态生成的URL与PHP简单的HTML DOM来解析,但该页面引导到使用Javascript其他动态greated URL,下面是它重定向解析用PHP简单的HTML DOM重定向页面
<script>window.addEventListener('load', function() { window.location.replace('http://thatsthem.com/search/417-272-0471/7312f62d') });</script>
所以我需要一种方法为PHP通过跟随重定向到http://thatsthem.com/search/417-272-0471/7312f62d
,然后分析该页面。但它所做的只是加载该JavaScript,然后执行它并打开新页面。
还是我一些如何使用正则表达式或一些提取的JavaScript的URL,然后有我的PHP只解析URL,这也将正常工作。但我无法弄清楚如何使用PHP将脚本从脚本中取出。
我觉得我现在在Inception
在此先感谢!
这里我的剧本是
<body>
<form method="post" id="primarysearchfomr">
<input name="number" type="text" value=""/>
<input type="submit" id="searchbutton"/>
</form>
<h1 id="searchform">Search Form</h1>
<?php
$searchterm= $_POST["number"];
$count = null;
$returnValue = str_replace(array("(",")","-"," "), '', $searchterm, $count);
include_once('simple_html_dom.php');
$target_url = "http://thatsthem.com/searching?ff=true&q0=" . $returnValue;
$html = new simple_html_dom();
$html->load_file($target_url);
foreach($html->find('script',2) as $link)
{
echo $link;
}
我很困惑。如果像你说的那样,你的脚本加载并执行基于JavaScript的重定向并出现在目标位置(但是你做到了这一点),那么你的问题是什么?那不是_exactly_你想要什么? – arkascha
你在哪里/如何动态生成此网址?如果你正在构建整个''块,那么大概你已经将url分开了。 –
不,我希望它能够解析重定向页面,然后呼应的元素解析不仅仅是加载页面 –