PHP DOMELement attribute value changed by itself
<p>This is quite a mystery for me.
I am trying to load external HTML via cURL and get elements by tag name (to get specific property)</p>

<pre><code>function getData($url) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
        curl_setopt($ch, CURLOPT_TIMEOUT, 60);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_URL, $url);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
}

$url = getData("https://example.com");
$dom = new DOMDocument();
$dom-&gt;loadHTML($url);
$aInputs = $dom-&gt;getElementsByTagName("input");
foreach($aInputs as $node) {
    echo $node-&gt;getAttribute("name");
}
</code></pre>

<p>but script dumps different values than expected. When I dump variable <code>$url</code> and inspect those inputs via inspector it shows correct values of attributes, but after creating DOMDocument they are wrong. What could possibly cause this? </p>

<p>EDIT: As I discovered that JS could be the fault. In browser JS changes some stuff which cURL doesn't. Is there a workaround to make cURL act like a browser?</p>