curl - PHP echo CSRF & STATE not appearing -


greetings stacksoverflow devs,

i'm trying figure out earlier why hidden input values @ website not appearing when try echo , used preg_match_all , made hidden value post.

i want echo both @ same time problem couz it's not appearing.

here code:

<?php  function get_data($url) {        $ch = curl_init();        $timeout = 10;        curl_setopt($ch,curlopt_url,$url);        curl_setopt($ch,curlopt_returntransfer,1);        curl_setopt($ch,curlopt_connecttimeout,$timeout);        $data = curl_exec($ch);        curl_close($ch);        return $data; }    $returned_content = get_data('https://secure.tesco.com/account/en-gb/login');  $container = $returned_content;  preg_match_all('(<form\s.*</form>)', $container, $forms);  print_r($forms);  $_post['_csrf'] = $csrf; $_post['state'] = $state;  echo "<font color=red><b>csrf</b></font> : ".$csrf."<br/>"; echo "<font color=red><b>state</b></font> : ".$state."<br/>";  ?>  

can me this?

xpath way go try this!

$dom = new \domdocument(); @$dom->loadhtml($container); $x = new \domxpath($dom); echo $_csrf = $x->query('//input[@name="_csrf"]')->item(0)->getattribute('value'); echo $state = $x->query('//input[@name="state"]')->item(0)->getattribute('value'); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -