netingest / netingest
A PHP SDK for NetIngest (https://netingest.com)
0.1.3
2024-01-18 17:15 UTC
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.8
- brianium/paratest: ^6.4
- friendsofphp/php-cs-fixer: ^3.9.5
- guzzlehttp/psr7: ^2.0
- phpmd/phpmd: 2.12.0
- phpstan/phpstan: 1.6.0
- phpunit/phpunit: @stable
- roave/security-advisories: dev-latest
- rregeer/phpunit-coverage-check: ^0.3.1
- squizlabs/php_codesniffer: ^3.7
README
Installation on your project
composer require netingest/netingest
Normal Usage
use NetIngest\NetIngest;
// HTTP is much faster than HTTPS, but insecure. Only use HTTP if you know what you are doing.
$netingest = Netingest::sdk('https://dns.url');
$netingest->init();
Extra options
use NetIngest\NetIngest;
$netingest = Netingest::sdk('https://dns.url');
// OPTIONAL: Disable SSL verification (this speeds up the connection to Netingest
$netingest->setSSLVerification(false); // Default: false
// OPTIONAL: Set the timeouts when connecting to Netingest
$netingest->setDefaultCurlOptTimeout(2);
$netingest->setDefaultCurlOptConnectTimeout(0);
// OPTIONAL: Debugging
$netingest->setDebug(true); // Default: false
$netingest->setDebugLogPath('/tmp/netingest.log'); // Default: use the PHP error log
// OPTIONAL: Set what headers we don't want to forward to Netingest.
// By default we don't forward the Authorization and Cookie headers.
$netingest->setBlacklistedHeaders(['Authorization','Cookie']); // Default: ['Authorization','Cookie']
$netingest->init();
Custom Integration
Normally Netingest takes care of blocking, throttling or showing captchas on your website. However, if you want to use Netingest with an API, or customize its integration, you can do it like this:
use NetIngest\NetIngest;
$netingest = Netingest::sdk('https://dns.url');
$netingest->setReturnRawApiResponse(true);
$response=$netingest->init();
// Code to handle the response