Reputation: 95
How to get a form with specific name using phpQuery?
<form method="POST" name="example">
<input type="hidden"
...
My try:
include 'phpQuery-onefile.php';
//example site with this form
$html = file_get_contents("http://www.example.com");
$pq = phpQuery::newDocument($html);
$a = $pq->find("form name=example");
Upvotes: 0
Views: 128
Reputation: 9080
phpQuery supports same CSS/jQuery like selectors, so this is what you want:
$a = pq("form[name=example]");
Note: Also change $pq->find
to pq
Example:
phpQuery::newDocumentHTML('<form method="POST" name="example">Something</form>');
$a = pq("form[name=example]");
echo $a;
Result:
Something
In your case through, it will return form's html.
Upvotes: 1