phpQuery::newDocumentFile PHP Method

newDocumentFile() public static method

Chainable.
public static newDocumentFile ( string $file, $contentType = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$file string URLs allowed. See File wrapper page at php.net for more supported sources.
return phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
    public static function newDocumentFile($file, $contentType = null)
    {
        $documentID = self::createDocumentWrapper(file_get_contents($file), $contentType);
        return new phpQueryObject($documentID);
    }

Usage Example

Ejemplo n.º 1
0
 public function testFind()
 {
     $htmlPath = BASE_PATH . '/samples/zingmp3_playlist.html';
     $document = phpQuery::newDocumentFile($htmlPath);
     $matches = $document->find('.item-song a.fn-name');
     $item = pq($matches[0]);
     $this->assertEquals('http://mp3.zing.vn/bai-hat/The-First-Noel-David-Archuleta/IW6UUBOW.html', $item->attr('href'), "Attribute and Value are not found");
 }
All Usage Examples Of phpQuery::newDocumentFile