Simpledom Interurl 变量

发布于 2024-11-10 05:41:53 字数 811 浏览 3 评论 0原文

我们公司运营大量服务器,

我们正在使用内部脚本来过滤各种信息,前端用户会说输入邮政编码,然后它将处理 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

年华零落成诗 2024-11-17 05:41:54

单引号 (') 之间的字符串不会被求值。 在您的程序中使用它之前,请尝试类似的操作

$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');

并检查 $postcode 值的有效值

the string beetwen single quotes (') don't get evaluated. try something like

$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');

and check the $postcode value for valid values before using it in your programs, please

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文