Skip to content

Instantly share code, notes, and snippets.

@markrickert
Created February 6, 2012 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markrickert/1752657 to your computer and use it in GitHub Desktop.
Save markrickert/1752657 to your computer and use it in GitHub Desktop.
phpQuery Example
<?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