I Just discovered domdocument and had previously been using regex..
I need to return the entire form element with all the inputs.
I don't need to create an entire document i just want that part, in a string that I can manipulate. I have been messing with the following chunk of code trying to make it do something useful, but so far, nothing.
Can anyone make sense of this before I go back to regex?
//get HTML into variable
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://www.openroadlending.com/Apply.aspx?aid=134');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$html=curl_exec($curl);
$dom = new domDocument;
@$dom->loadHTML($html);
$dom->preserveWhiteSpace=false;
$xpath = new DOMXPath($dom);
$body = $xpath->query('html/');
echo var_dump($body);
//echo $body->item(0);
$inputs = $xpath->getElementsByTagName('form');
// foreach($inputs as $in){
// $input = $in->saveHTML;
// //echo $input;
// }