I am new to PHP.
I am trying to scrape a webpage and pull the value to my input box.
Scrapping is done, and stored in array,
<?php
function codeAddress1() {
$html = file_get_contents("http://geoportaal.maaamet.ee/url/xgis-ky.php?ky=79401:006:0812");
preg_match_all('(<li.*?>.*?</li>)', $html, $matches);
var_dump($matches[0][0]);
$one=$matches[0][0];
var_dump($one);
}
?>
On button click i called function :
<input type="submit" CssClass="button" value="Search" width="35%" onclick="codeAddress1()">
Now i wanted to save the variable $one to my input box, i tried several, its not working.
like
<input id="t49" type="text" class="textbox" value="<?php echo @$one; ?>">
Any idea where i am going wrong.
Not quite sure what you want but
<li>(.*?)<\/li>
This will give you
<b>Maakond</b> : Tartu maakond
in $matches[1][0] and
<b>Omavalitsus</b> : Tartu vald
in $matches[1][1] etc. etc.