i have 2 sites: foo.com and bar.com
foo.com has form with content from its database. what i want is to get that content from each input, textarea in the form.
I can access to the code of the foo.com via curl (at bar.com):
<?php
$post='pswd';
$site='foo.com';
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $site);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, "pswd=$post");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($c);
curl_close($c);
?>
and i get whole html with form and inputs like:
<textarea name="inputname" class="longone">inputcontent</textarea>
and i have no idea how to start extracting datas and save it in this way:
$inputname='inputcontent';
could you give me any advice? thank you in advance
EDIT:
I forgot to tell you that i know some of the inputnames and the others vary only the last chars - number e.g. inputnameiknow1, inputnameiknow2 ...
Edit 2 - solution thanks to baba
simplehtml dom uses file_get_contents so to send vars as POST follow: How to post data in PHP using file_get_contents?
to get input names just ask for 'name'
so my code looks like Baba's but added
$element->name
to extract inputname