You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ This package can be found on [packagist](https://packagist.org/packages/paquettg
23
23
Usage
24
24
-----
25
25
26
-
You can find many examples of how to use the dom parser and any of its parts (which you will most likely never touch) in the tests directory. The tests are done using PHPUnit and are very small, a few lines each, and are a great place to start. Given that, I'll still be showing a few examples of how the package should be used. The following example is a very simplistic usage of the package.
26
+
You can find many examples of how to use the DOM parser and any of its parts (which you will most likely never touch) in the tests directory. The tests are done using PHPUnit and are very small, a few lines each, and are a great place to start. Given that, I'll still be showing a few examples of how the package should be used. The following example is a very simplistic usage of the package.
27
27
28
28
```php
29
29
// Assuming you installed from Composer:
@@ -36,12 +36,12 @@ $a = $dom->find('a')[0];
36
36
echo $a->text; // "click here"
37
37
```
38
38
39
-
The above will output "click here". Simple no? There are many ways to get the same result from the dome, such as `$dom->getElementsbyTag('a')[0]` or `$dom->find('a', 0)` which can all be found in the tests or in the code itself.
39
+
The above will output "click here". Simple, no? There are many ways to get the same result from the DOM, such as `$dom->getElementsbyTag('a')[0]` or `$dom->find('a', 0)`, which can all be found in the tests or in the code itself.
40
40
41
41
Loading Files
42
42
------------------
43
43
44
-
You may also seamlessly load a file into the dom instead of a string, which is much more convenient and is how I except most developers will be loading the html. The following example is taken from our test and uses the "big.html" file found there.
44
+
You may also seamlessly load a file into the DOM instead of a string, which is much more convenient and is how I expect most developers will be loading the HTML. The following example is taken from our test and uses the "big.html" file found there.
45
45
46
46
```php
47
47
// Assuming you installed from Composer:
@@ -67,12 +67,12 @@ foreach ($contents as $content)
67
67
}
68
68
```
69
69
70
-
This example loads the html from big.html, a real page found online, and gets all the content-border classes to process. It also shows a few things you can do with a node but it is not an exhaustive list of methods that a node has available.
70
+
This example loads the html from big.html, a real page found online, and gets all the content-border classes to process. It also shows a few things you can do with a node but it is not an exhaustive list of the methods that a node has available.
71
71
72
-
Loading Url
72
+
Loading URLs
73
73
----------------
74
74
75
-
Loading a url is very similar to the way you would load the html from a file.
75
+
Loading a URL is very similar to the way you would load the HTML from a file.
$html = $dom->outerHtml; // same result as the first example
89
89
```
90
90
91
-
loadFromUrl will, by default, use an implementation of the `\Psr\Http\Client\ClientInterface` to do the HTTP request and a default implementation of `\Psr\Http\Message\RequestInterface` to create the body of the request. You can easely implement your own version of either the client or request to use a custom HTTP connection when using loadFromUrl.
91
+
loadFromUrl will, by default, use an implementation of the `\Psr\Http\Client\ClientInterface` to do the HTTP request and a default implementation of `\Psr\Http\Message\RequestInterface` to create the body of the request. You can easily implement your own version of either the client or request to use a custom HTTP connection when using loadFromUrl.
92
92
93
93
```php
94
94
// Assuming you installed from Composer:
@@ -101,7 +101,7 @@ $dom->loadFromUrl('http://google.com', null, new MyClient());
101
101
$html = $dom->outerHtml;
102
102
```
103
103
104
-
As long as the client object implements the interface properly it will use that object to get the content of the url.
104
+
As long as the client object implements the interface properly, it will use that object to get the content of the url.
0 commit comments