1. Go to this page and download the library: Download ijortengab/browser 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/ */
ijortengab / browser example snippets
// Simple request.
$browser = Browser::profile('Mozilla Firefox on Windows 7');
$browser->setUrl('http://httpbin.org/html')->execute();
$html = (string) $browser->result;
// Post request, login, and enter to authenticated page.
$browser = Browser::profile('Mobile');
$browser->setUrl('http://httpbin.org/post');
$browser->post([
'username' => 'IwanFals',
'password' => 'SoreTuguPancoran',
]);
$browser->headers('Referer', 'http://httpbin.org/');
$browser->options('timeout', 5);
$browser->execute();
// Cookie automatically saved.
$browser->reset()->setUrl('http://httpbin.org/member-area-only')->execute();
// Cookie automatically loaded, and with session information in cookie
// you can enter page which is for authenticated only.
$code = $browser->result->code; // 200 OK.
$html = $browser->result->data;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.