Skip to content
This repository was archived by the owner on Jul 3, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions proxycrawl-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
* Copyright ProxyCrawl
* Licensed under the Apache License 2.0
*/
define('PROXYCRAWL_API_URL', 'https://api.proxycrawl.com/');

class ProxyCrawlAPI {

const PUBLIC_PROXYCRAWL_API_URL = 'https://api.proxycrawl.com/';

public $timeout = 30000;
public $debug = false;
public $advDebug = false; // Note that enabling advanced debug will include debugging information in the response possibly breaking up your code
Expand All @@ -21,8 +22,10 @@ public function __construct($options = []) {
if (empty($options['token'])) {
throw new Exception('You need to specify the token');
}

$apiBaseUrl = isset($options['apiBaseUrl']) ? $options['apiBaseUrl'] : static::PUBLIC_PROXYCRAWL_API_URL;
$this->options = $options;
$this->endPointUrl = PROXYCRAWL_API_URL . '?token=' . $options['token'];
$this->endPointUrl = $apiBaseUrl . '?token=' . $options['token'];
}

public function get(string $url, array $options = []) {
Expand Down