我有以下网址,需要在我的XML上复制相同的参数。
URL:
http://192.192.192.192/api/captureserver?MessageType=CaptureLookup&MachineName=00321A&RegistrationMark=MRU&DateRange=20171219-20171219.
我需要在XML上获取MachineName。
这是我的剧本:
<?php
header ("content-type: text/xml");
$connection = mysqli_connect('127.0.0.1', 'root', 'admin', 'Customer_1') or die("cannot connect");
$xml='<?xml version="1.0" encoding="UTF-8"?>';
$RegistrationMark = $_GET['RegistrationMark'];
$qr= mysqli_query($connection, "SELECT * FROM `EarlsdonMSIN_anpr_vega` where `RegistrationMark` like '%" .$RegistrationMark. "%'");
$xml.='<MatchRecords>';
while($res=mysqli_fetch_array($qr))
{
$xml.='<MatchLine><id>'.$res['id'].'</id><RegistrationMark>'.$res['RegistrationMark'].'</RegistrationMark><datetime>'.$res['datetime'].'</datetime><time>'.$res['time'].'</time><image_name>'.$res['image_name'].'</image_name></MatchLine>';
}
$xml.='</MatchRecords>';
echo $xml;
?>
尝试了这个:
$xml.='<MatchLine><id>'.$res['id'].'</id><MachineName>'.$res['MachineName'].'</MachineName><RegistrationMark>'.$res['RegistrationMark'].'</RegistrationMark><datetime>'.$res['datetime'].'</datetime><time>'.$res['time'].'</time><image_name>'.$res['image_name'].'</image_name></MatchLine>';
}