开发者

Simpledom Interurl variables

开发者 https://www.devze.com 2023-03-09 02:18 出处:网络
Out company operate numerous ser开发者_运维百科vers 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 proc

Out company operate numerous ser开发者_运维百科vers

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号