Simpledom Interurl 变量
我们公司运营大量服务器,
我们正在使用内部脚本来过滤各种信息,前端用户会说输入邮政编码,然后它将处理 1 页信息中的 5 页列表。
注意:我们知道我们的代码可能不是最简单的,但它目前似乎可以工作,任何知道更简单方法的人请说我们
<?php $postcode = $_POST['postcode']; ?>
// get DOM from URL or file
$html = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location=$postcode&x=39&y=9&Page=1');
$html1 = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location=$postcode&x=39&y=9&Page=2');
$html2 = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location=sa11&x=39&y=9&Page=3');
有进一步的代码可以过滤掉我们的服务器结果,但出于某种原因当我们的一个用户将表单发布到此脚本时,只有底部结果会返回,纯粹是因为位置是硬编码的 - 其他结果返回未知,我们认为它没有正确地将邮政编码变量传递给网址,
可能是因为$邮政编码变量已经在 $html 变量内,有办法解决这个问题吗?
谢谢
Out company operate numerous servers
We are using a internal script to filter out various pieces of information , The frontend users will be say entering a postcode , it will then process a list of 5 pages in 1 page of information .
Note: we know our code may not be the most simplistic but it seems to work at the moment , any 1 that knows a easier way to do it then please do say
<?php $postcode = $_POST['postcode']; ?>
// get DOM from URL or file
$html = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location=$postcode&x=39&y=9&Page=1');
$html1 = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location=$postcode&x=39&y=9&Page=2');
$html2 = file_get_html('http://xx.com/en/search/records/search.pub?Surname=willi*&Location=sa11&x=39&y=9&Page=3');
we have further code which filters out our servers results , but for some reason when one of our users posts the form to this script , only the bottom result is coming back purely because the location is hardcoded - the others are coming back unknown and we think that it isnt passing the postcode variable to the urls correctly
could it be because the $postcode variable is already inside the $html variable , is there a way to get around this issue ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
单引号 (') 之间的字符串不会被求值。 在您的程序中使用它之前,请尝试类似的操作
并检查 $postcode 值的有效值
the string beetwen single quotes (') don't get evaluated. try something like
and check the $postcode value for valid values before using it in your programs, please