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
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,8 @@ Loading Files
37
37
You may also seamlessly load a file into the dom instead of a string, which is much more convinient 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.
38
38
39
39
```php
40
+
// Assuming you installed from Composer:
41
+
require "vendor/autoload.php";
40
42
use PHPHtmlParser\Dom;
41
43
42
44
$dom = new Dom;
@@ -68,6 +70,8 @@ Loading Url
68
70
Loading a url is very similar to the way you would load the html from a file.
69
71
70
72
```php
73
+
// Assuming you installed from Composer:
74
+
require "vendor/autoload.php";
71
75
use PHPHtmlParser\Dom;
72
76
73
77
$dom = new Dom;
@@ -82,6 +86,8 @@ $html = $dom->outerHtml; // same result as the first example
82
86
What makes the loadFromUrl method note worthy is the `PHPHtmlParser\CurlInterface` parameter, an optional second parameter. By default, we use the `PHPHtmlParser\Curl` class to get the contents of the url. On the other hand, though, you can inject your own implementation of CurlInterface and we will attempt to load the url using what ever tool/settings you want, up to you.
83
87
84
88
```php
89
+
// Assuming you installed from Composer:
90
+
require "vendor/autoload.php";
85
91
use PHPHtmlParser\Dom;
86
92
use App\Services\Connector;
87
93
@@ -98,6 +104,8 @@ Loading Strings
98
104
Loading a string directly, with out the checks in `load()` is also easely done.
99
105
100
106
```php
107
+
// Assuming you installed from Composer:
108
+
require "vendor/autoload.php";
101
109
use PHPHtmlParser\Dom;
102
110
103
111
$dom = new Dom;
@@ -113,6 +121,8 @@ Options
113
121
You can also set parsing option that will effect the behavior of the parsing engine. You can set a global option array using the `setOptions` method in the `Dom` object or a instance specific option by adding it to the `load` method as an extra (optional) parameter.
0 commit comments