1. Go to this page and download the library: Download msankhala/parsehub-php 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/ */
// Get project_token and run_token from DB.
$project_token = <get project token from db>
$run_token = <get project token from db>
$parsehub = new Parsehub($api_key);
$project = $parsehub->getProject($project_token);
echo $project;
$parsehub = new Parsehub($api_key);
$data = $parsehub->getLastReadyRunData($project_token);
print $data;
$parsehub = new Parsehub($api_key);
$data = $parsehub->getRunData($run_token);
print $data;
$parsehub = new Parsehub($api_key);
$run = $parsehub->getRun($run_token);
print $run;
$parsehub = new Parsehub($api_key);
$options = array(
// Skip start_url option if don't want to override starting url configured
// on parsehub.
'start_url' => '<starting url at which crawling starts>'
// Enter comma separated list of keywords to pass into `start_value_override`
'keywords' => 'iphone case, iphone copy'
// Set send_email options. Skip to remain this value default.
'send_email' => 1,
);
$run_obj = $parsehub->runProject($project_token, $options);
echo $run_obj;
$parsehub = new Parsehub($api_key);
$cancel = $parsehub->cancelProjectRun($run_token);
print $cancel;
$parsehub = new Parsehub($api_key);
$cancel = $parsehub->deleteProjectRun($run_token);
print $cancel;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.