Свойство | Тип | Описание | |
---|---|---|---|
$uri | The current URI |
Метод | Описание | |
---|---|---|
__construct ( mixed $node = null, string $currentUri = null, string $baseHref = null ) | ||
add ( DOMNodeList | DOMNode | array | string | null $node ) | Adds a node to the current list of nodes. | |
addContent ( string $content, null | string $type = null ) | Adds HTML/XML content. | |
addDocument ( DOMDocument $dom ) | Adds a \DOMDocument to the list of nodes. | |
addHtmlContent ( string $content, string $charset = 'UTF-8' ) | Adds an HTML content to the list of nodes. | |
addNode ( DOMNode $node ) | Adds a \DOMNode instance to the list of nodes. | |
addNodeList ( DOMNodeList $nodes ) | Adds a \DOMNodeList to the list of nodes. | |
addNodes ( array $nodes ) | Adds an array of \DOMNode instances to the list of nodes. | |
addXmlContent ( string $content, string $charset = 'UTF-8', integer $options = LIBXML_NONET ) | Adds an XML content to the list of nodes. | |
attr ( string $attribute ) : string | null | Returns the attribute value of the first node of the list. | |
children ( ) : |
Returns the children nodes of the current selection. | |
clear ( ) | Removes all the nodes. | |
count ( ) : integer | ||
each ( Closure $closure ) : array | Calls an anonymous function on each node of the list. | |
eq ( integer $position ) : |
Returns a node given its position in the node list. | |
evaluate ( string $xpath ) : array | |
Evaluates an XPath expression. | |
extract ( array $attributes ) : array | Extracts information from the list of nodes. | |
filter ( string $selector ) : |
Filters the list of nodes with a CSS selector. | |
filterXPath ( string $xpath ) : |
Filters the list of nodes with an XPath expression. | |
first ( ) : |
Returns the first node of the current selection. | |
form ( array $values = null, string $method = null ) : |
Returns a Form object for the first node in the list. | |
getBaseHref ( ) : string | Returns base href. | |
getIterator ( ) : ArrayIterator | ||
getNode ( integer $position ) : DOMElement | null | ||
getUri ( ) : string | Returns the current URI. | |
html ( ) : string | Returns the first node of the list as HTML. | |
image ( ) : Symfony\Component\DomCrawler\Image | Returns an Image object for the first node in the list. | |
images ( ) : Symfony\Component\DomCrawler\Image[] | Returns an array of Image objects for the nodes in the list. | |
last ( ) : |
Returns the last node of the current selection. | |
link ( string $method = 'get' ) : Symfony\Component\DomCrawler\Link | Returns a Link object for the first node in the list. | |
links ( ) : Symfony\Component\DomCrawler\Link[] | Returns an array of Link objects for the nodes in the list. | |
nextAll ( ) : |
Returns the next siblings nodes of the current selection. | |
nodeName ( ) : string | Returns the node name of the first node of the list. | |
parents ( ) : |
Returns the parents nodes of the current selection. | |
previousAll ( ) : |
Returns the previous sibling nodes of the current selection. | |
reduce ( Closure $closure ) : |
Reduces the list of nodes by calling an anonymous function. | |
registerNamespace ( string $prefix, string $namespace ) | ||
selectButton ( string $value ) : |
Selects a button by name or alt value for images. | |
selectImage ( string $value ) : |
Selects images by alt value. | |
selectLink ( string $value ) : |
Selects links by name or alt value for clickable images. | |
setDefaultNamespacePrefix ( string $prefix ) | Overloads a default namespace prefix to be used with XPath and CSS expressions. | |
siblings ( ) : |
Returns the siblings nodes of the current selection. | |
slice ( integer $offset, integer $length = null ) : |
Slices the list of nodes by $offset and $length. | |
text ( ) : string | Returns the node value of the first node of the list. | |
xpathLiteral ( string $s ) : string | Converts string for XPath expressions. |
Метод | Описание | |
---|---|---|
sibling ( DOMElement $node, string $siblingDir = 'nextSibling' ) : array |
Метод | Описание | |
---|---|---|
createDOMXPath ( DOMDocument $document, array $prefixes = [] ) : DOMXPath | ||
createSubCrawler ( DOMElement | DOMElement[] | DOMNodeList | null $nodes ) : static | Creates a crawler for some subnodes. | |
discoverNamespace ( DOMXPath $domxpath, string $prefix ) : string | ||
filterRelativeXPath ( string $xpath ) : |
Filters the list of nodes with an XPath expression. | |
findNamespacePrefixes ( string $xpath ) : array | ||
relativize ( string $xpath ) : string | Make the XPath relative to the current context. |
public addDocument ( DOMDocument $dom ) | ||
$dom | DOMDocument | A \DOMDocument instance |
public addHtmlContent ( string $content, string $charset = 'UTF-8' ) | ||
$content | string | The HTML content |
$charset | string | The charset |
public addNode ( DOMNode $node ) | ||
$node | DOMNode | A \DOMNode instance |
public addNodeList ( DOMNodeList $nodes ) | ||
$nodes | DOMNodeList | A \DOMNodeList instance |
public addXmlContent ( string $content, string $charset = 'UTF-8', integer $options = LIBXML_NONET ) | ||
$content | string | The XML content |
$charset | string | The charset |
$options | integer | Bitwise OR of the libxml option constants LIBXML_PARSEHUGE is dangerous, see http://symfony.com/blog/security-release-symfony-2-0-17-released |
public children ( ) : |
||
Результат | A Crawler instance with the children nodes |
public filterXPath ( string $xpath ) : |
||
$xpath | string | An XPath expression |
Результат | A new instance of Crawler with the filtered list of nodes |
public first ( ) : |
||
Результат | A Crawler instance with the first selected node |
public image ( ) : Symfony\Component\DomCrawler\Image | ||
Результат | Symfony\Component\DomCrawler\Image | An Image instance |
public images ( ) : Symfony\Component\DomCrawler\Image[] | ||
Результат | Symfony\Component\DomCrawler\Image[] | An array of Image instances |
public last ( ) : |
||
Результат | A Crawler instance with the last selected node |
public links ( ) : Symfony\Component\DomCrawler\Link[] | ||
Результат | Symfony\Component\DomCrawler\Link[] | An array of Link instances |
public nextAll ( ) : |
||
Результат | A Crawler instance with the next sibling nodes |
public parents ( ) : |
||
Результат | A Crawler instance with the parents nodes of the current selection |
public previousAll ( ) : |
||
Результат | A Crawler instance with the previous sibling nodes |
public registerNamespace ( string $prefix, string $namespace ) | ||
$prefix | string | |
$namespace | string |
public selectButton ( string $value ) : |
||
$value | string | The button text |
Результат | A new instance of Crawler with the filtered list of nodes |
public selectImage ( string $value ) : |
||
$value | string | The image alt |
Результат | A new instance of Crawler with the filtered list of nodes |
public selectLink ( string $value ) : |
||
$value | string | The link text |
Результат | A new instance of Crawler with the filtered list of nodes |
public setDefaultNamespacePrefix ( string $prefix ) | ||
$prefix | string |
public siblings ( ) : |
||
Результат | A Crawler instance with the sibling nodes |
echo Crawler::xpathLiteral('foo " bar');
prints 'foo " bar'
echo Crawler::xpathLiteral("foo ' bar");
prints "foo ' bar"
echo Crawler::xpathLiteral('a\'b"c');
prints concat('a', "'", 'b"c')
public static xpathLiteral ( string $s ) : string | ||
$s | string | String to be escaped |
Результат | string | Converted string |