1. Go to this page and download the library: Download sahil-gulati/fcrawling 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/ */
sahil-gulati / fcrawling example snippets
Crawling\FCrawling;
use FCrawling\FCrawlingRequest;
try {
/**
* Callback function type
* (String) `callback_function` global function
* (Array) array => 0 (Object) $classObject array => 1 (String) function_name(public)
* (Array) array => 0 (String) class_name array => 1 (String) function_name(public static)
**/
$fcrawlingObj= new FCrawling("callback_function");
/**
* Execution type can 'parallel' or 'serial'
* Defaults to 'parallel'
**/
$fcrawlingObj->setExecutionType("parallel");
/**
* Setting group size for execution
* Each group will executed sequencially
* Defaults to 'none'
**/
$fcrawlingObj->setGroupSize(2);
/**
* Setting window size for adding requests
* Each FCrawling object can handle upto window sized requests,
* else exception is thrown
* Defaults to '10000'
**/
$fcrawlingObj->setWindowSize(100);
/**
* Setting output reliability, Nothing is returned in case of non reliable output
* Defaults to 'true'
**/
$fcrawlingObj->setOutputReliability(false);
//Request 1
$fcrawlingRequestObj = new FCrawlingRequest("http://www.example.com?name=sahil&browser=chrome");
$fcrawlingRequestObj->setOption(array(
CURLOPT_POSTFIELDS=>array("somekey"=>"somevalue")
));
$fcrawlingObj->setRequest($fcrawlingRequestObj);
//Request 2
$fcrawlingRequestObj = new FCrawlingRequest("http://www.example.com?name=sahil&browser=chrome");
$fcrawlingRequestObj->setOption(array(
CURLOPT_HTTPHEADER=>array("Content-Type: application/json")
));
$fcrawlingObj->setRequest($fcrawlingRequestObj);
//Request 3
$fcrawlingRequestObj = new FCrawlingRequest();
$fcrawlingRequestObj->setOption(array(
CURLOPT_URL=>array("http://www.example.com?name=sahil&browser=chrome")
));
$fcrawlingObj->setRequest($fcrawlingRequestObj);
$fcrawlingObj->execute();
}
catch(FCrawlingException $fex)
{
echo $fex->getMessage();
}
function callback_function($response,$responseNo,$info,$groupNo)
{
print_r(func_get_args());
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.