PHP code example of growthexponent / laravel-html-dom-parser
1. Go to this page and download the library: Download growthexponent/laravel-html-dom-parser library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
growthexponent / laravel-html-dom-parser example snippets
$proxy = "120.195.203.43:80";
$proxy = explode(':', $proxy);
loadFromUrlByProxy($url, $options = [], CurlInterface $curl = null, $proxy = null)
"growthexponent/laravel-html-dom-parser": "1.0.*"
composer update
app/config/app.php
'LaravelHtmlDomParser\LaravelHtmlDomParserServiceProvider',
use LaravelHtmlDomParser\LaravelHtmlDomParser;
class ...Controller extends Controller
{
/**
* ....
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$parser = new LaravelHtmlDomParser();
$proxy = "120.195.203.43:80";
$proxy = explode(':', $proxy);
$html = $parser->loadFromUrlByProxy('http://www.growthexponent.com', [], null, $proxy);
dd($html);
}
}