xymcrush17 Posted February 5, 2017 Share Posted February 5, 2017 (edited) Hello Need a help How to parse file_get_content into an array? <?php include_once('get_data.php');//simple_html_dom.php $postdata = http_build_query( array( 'id' => 'xxx', ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents('http://localhost/test.php', false, $context); I want only get a text that in attribute <div id="console"> YYYY </div> based on $result text that i expect is YYYY thank in advance Edited February 5, 2017 by xymcrush17 Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted February 5, 2017 Share Posted February 5, 2017 (edited) So what have you tried so far? Your code doesn't show any parsing attempts. The task looks rather strange. You're posting data to your own scripts and scraping the response. How will the final application look like? Where does the data go? Why do you have to resort to scraping? Your choice of tools is strange as well. Consider using cURL with a standard HTML parser like DOMDocument. Edited February 5, 2017 by Jacques1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.