Created
February 6, 2012 15:26
-
-
Save markrickert/1752657 to your computer and use it in GitHub Desktop.
phpQuery Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Get the HTML string from cURL | |
//Create new instance of phpQuery | |
//We assume the phpoQuery library is included at the top or your script. | |
phpQuery::newDocument($document_html_string); | |
$inputs = array(); //Create an empty array to hold the inputs. | |
//Get all the inputs on the page and put them in an array. | |
foreach(pq(':input') as $id => $block) { | |
$inputs[pq($block)->attr('name')] = pq($block)->attr('value'); | |
} | |
//Post those inputs back to the login form. | |
// Make sure to overwrite the blank username/password fields in that array. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment