PHP code example of jtanjung / pehape

1. Go to this page and download the library: Download jtanjung/pehape 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/ */

    

jtanjung / pehape example snippets


use Pehape\Services\WebPageService;

$service = new WebPageService();
//$service->config->Setting->firefox->command = '{driver folder}/geckodriver'; // Geckodriver use 4444 as a default port
$service->config->Setting->chrome->command = '{driver folder}/chromedriver --port=4443'; // Set port 4443 for chrome
//$service->config->Setting->opera->command = '{driver folder}/operadriver --port=4445'; // Set port 4445 for opera

/** If you decide to use different ports, you also must change the host config value. e.g below: **/
/*
$service->config->Setting->chrome->command = '{driver folder}/chromedriver --port=5000';
//$service->config->Setting->opera->command = '{driver folder}/operadriver --port=5001';
$service->config->Setting->chrome->host = "http://localhost:5000";
//$service->config->Setting->opera->host = "http://localhost:5001";
*/

$service->Chrome()->Create();
$service->get('https://www.google.com/');
$service->quit();