I am mediocre with php and ignorant with XML...if you can be detailed it will help me learn.

I am attempting to use PHP programming to execute a scripts to this link... <http://ws.geonames.org/postalCodeSearch?postalcode=VARIABLE_ZIP&country=US>. The VARIABLE\_ZIP is the actual zip code entered into the form that will submit the information in the link above. The output of that link creates an XML page that i do not want displayed anywhere on my website.

What I want to do is capture the XML data Latitude and Longitude values as variables within php and store them into a database.

1) I have a form

2) The user inputs their zip code into the form

3) upon submitting the form: I want code to capture the XML data generated by the link with the zip code variable added: <http://ws.geonames.org/postalCodeSearch?postalcode=90210&country=US> (I don't want this page to display anywhere, I just want to capture the data)

4) I want to take those variables back to PHP so I can store them in my database 

\*Step 3 is an unknown process for me.
This is what the XML code generates on a separate page...(i don't want a page to display):

= = = = = 

```
<geonames>
<totalResultsCount>1</totalResultsCount>
<code><postalcode>90210</postalcode>
<name>Beverly Hills</name>
<countryCode>US</countryCode>
<lat>34.09011</lat>
<lng>-118.40648</lng>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<adminCode2>037</adminCode2>
<adminName2>Los Angeles</adminName2>
<adminCode3/><adminName3/>
</code>
</geonames>

```

= = = = =

Someone provided me with the following but I am not sure how to execute it and parse the variables I need:

```
<?php
$pc = $_POST['postalcode'];
$c = $_POST['country'];
$xml = file_get_contents("http://ws.geonames.org/postalCodeSearch?postalcode={$pc}&country={$c}");
file_put_contents("geopost_{$pc}_{$c}.xml",$xml);
?>

```

Thank you for your assistance!