Within your foreach loop, you need to wrap the $a
with a pq()
.
For example:
$all = phpQuery::newDocumentFileHTML("http://www.mysite.com", $charset = 'utf-8');
$imgs = $all['img'];
foreach ($imgs as $img) {
// Note: $img must be used like "pq($img)"
echo pq($img)->attr('src');
}