From a045760cf15bf9d1cb0bf7db85ee754929f1b049 Mon Sep 17 00:00:00 2001 From: vlad-outscraper Date: Tue, 19 Jul 2022 10:57:28 +0300 Subject: [PATCH] migrate --- README.md | 34 +++++++++++------- composer.json | 29 ++++++++-------- examples/Emails And Contacts.md | 35 +++++++++++++++++++ init.php | 3 ++ google-maps-scraper.php => outscraper.php | 42 +++++++++++------------ 5 files changed, 95 insertions(+), 48 deletions(-) create mode 100644 examples/Emails And Contacts.md create mode 100644 init.php rename google-maps-scraper.php => outscraper.php (90%) diff --git a/README.md b/README.md index 0ed13b2..fff3576 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,33 @@ -# Outscraper SDK in PHP +# Outscraper PHP Library -PHP SDK that allows using [Outscraper's services](https://outscraper.com/services/) and [Outscraper's API](https://app.outscraper.com/api-docs). - -## List of Supported Services -- [Google Maps Scraper](https://outscraper.com/google-maps-scraper/) -- [Google Maps Reviews Scraper](https://outscraper.com/google-maps-reviews-scraper/) -- [Google Maps Photos Scraper](https://outscraper.com/google-maps-photos-scraper/) -- [Google Play Reviews Scraper](https://outscraper.com/google-maps-photos-scraper/) -- [Emails & Contacts Scraper](https://outscraper.com/emails-scraper/) +The library provides convenient access to the [Outscraper API](https://app.outscraper.com/api-docs) from applications written in the PHP language. Allows using [Outscraper's services](https://outscraper.com/services/) from your code. [API Docs](https://app.outscraper.com/api-docs) ## Installation -The Google Maps scraper PHP SDK can be installed with [Composer](https://getcomposer.org/). Run this command: +### Composer + +You can install the bindings via [Composer](http://getcomposer.org/). Run the following command: + +```bash +composer require outscraper/outscraper +``` + +To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading): -```sh -composer require outscraper/google-maps-scraper-php +```php +require_once('vendor/autoload.php'); ``` -[Link to the php package page](https://packagist.org/packages/outscraper/google-maps-scraper-php) +### Manual Installation + +If you do not wish to use Composer, you can download the [latest release](https://github.com/outscraper/outscraper-php/releases). Then, to use the bindings, include the `init.php` file. + +```php +require_once('/path/to/outscraper-php/init.php'); +``` +[Link to the PHP package page](https://packagist.org/packages/outscraper/outscraper) ## Google Maps Scraper diff --git a/composer.json b/composer.json index b7574d2..5b71d52 100644 --- a/composer.json +++ b/composer.json @@ -1,34 +1,35 @@ { - "name": "outscraper/google-maps-scraper-php", - "description": "PHP SDK that allows scraping Google Maps and Google Reviews via Outscraper API.", + "name": "outscraper/outscraper", + "description": "PHP bindings for the Outscraper API", "require": { "php": ">=7.4" }, "keywords": [ - "Google", - "Outscrpaer", - "Google Maps", - "Google Reviews", - "Google Maps scraper", - "Google Reviews scraper", + "outscraper", + "google Maps", + "google maps scraper", + "google reviews scraper", "scrape google maps", - "Google Places" + "google", + "scraper", + "extractor", + "webscraper" ], - "homepage": "https://github.com/outscraper/google-maps-scraper-php", + "homepage": "https://outscraper.com/", "license": "MIT", "authors": [ { - "name": "Vlad", + "name": "Outscraper", "role": "Developer", - "email": "vlad@outscraper.com" + "email": "support@outscraper.com" } ], "support": { - "issues": "https://github.com/outscraper/google-maps-scraper-php/issues" + "issues": "https://github.com/outscraper/outscraper-php/issues" }, "autoload": { "files": [ - "google-maps-scraper.php" + "outscraper.php" ] } } diff --git a/examples/Emails And Contacts.md b/examples/Emails And Contacts.md new file mode 100644 index 0000000..4b29ed7 --- /dev/null +++ b/examples/Emails And Contacts.md @@ -0,0 +1,35 @@ +# Emails And Contacts Scraper With PHP + +Allows finding email addresses, social links, and phones from domains via [Outscraper API](https://app.outscraper.com/api-docs#tag/Emails-and-Contacts). + +## Installation + +### Composer + +You can install the bindings via [Composer](http://getcomposer.org/). Run the following command: + +```bash +composer require outscraper/outscraper +``` + +To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading): + +```php +require_once('vendor/autoload.php'); +``` + +### Manual Installation + +If you do not wish to use Composer, you can download the [latest release](https://github.com/outscraper/outscraper-php/releases). Then, to use the bindings, include the `init.php` file. + +```php +require_once('/path/to/outscraper-php/init.php'); +``` +[Link to the PHP package page](https://packagist.org/packages/outscraper/outscraper) + +## Usage + +```php +# Search contacts from website: +result = client.emails_and_contacts(['outscraper.com']) +``` diff --git a/init.php b/init.php new file mode 100644 index 0000000..256213f --- /dev/null +++ b/init.php @@ -0,0 +1,3 @@ + $this->to_array($query), "language" => $language, "region" => $region, - "organizationsPerQueryLimit" => $organizations_per_query_limit, + "organizationsPerQueryLimit" => $limit, "coordinates" => $coordinates, "extractContacts" => $extract_contacts, "dropDuplicates" => $drop_duplicates, @@ -162,7 +162,7 @@ public function google_maps_search( * @param string|array $query Parameter defines the query or queries you want to search on Google Maps. Using an array allows multiple queries to be sent in one request and save on network latency time. * @param string $language Parameter specifies the language to use for Google. Available values: "en", "de", "es", "es-419", "fr", "hr", "it", "nl", "pl", "pt-BR", "pt-PT", "vi", "tr", "ru", "ar", "th", "ko", "zh-CN", "zh-TW", "ja", "ach", "af", "ak", "ig", "az", "ban", "ceb", "xx-bork", "bs", "br", "ca", "cs", "sn", "co", "cy", "da", "yo", "et", "xx-elmer", "eo", "eu", "ee", "tl", "fil", "fo", "fy", "gaa", "ga", "gd", "gl", "gn", "xx-hacker", "ht", "ha", "haw", "bem", "rn", "id", "ia", "xh", "zu", "is", "jw", "rw", "sw", "tlh", "kg", "mfe", "kri", "la", "lv", "to", "lt", "ln", "loz", "lua", "lg", "hu", "mg", "mt", "mi", "ms", "pcm", "no", "nso", "ny", "nn", "uz", "oc", "om", "xx-pirate", "ro", "rm", "qu", "nyn", "crs", "sq", "sk", "sl", "so", "st", "sr-ME", "sr-Latn", "su", "fi", "sv", "tn", "tum", "tk", "tw", "wo", "el", "be", "bg", "ky", "kk", "mk", "mn", "sr", "tt", "tg", "uk", "ka", "hy", "yi", "iw", "ug", "ur", "ps", "sd", "fa", "ckb", "ti", "am", "ne", "mr", "hi", "bn", "pa", "gu", "or", "ta", "te", "kn", "ml", "si", "lo", "my", "km", "chr". * @param string $region Parameter specifies the region to use for Google. Available values: "AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AG", "AR", "AM", "AU", "AT", "AZ", "BS", "BH", "BD", "BY", "BE", "BZ", "BJ", "BT", "BO", "BA", "BW", "BR", "VG", "BN", "BG", "BF", "BI", "KH", "CM", "CA", "CV", "CF", "TD", "CL", "CN", "CO", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "EE", "ET", "FJ", "FI", "FR", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GT", "GG", "GY", "HT", "HN", "HK", "HU", "IS", "IN", "ID", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KW", "KG", "LA", "LV", "LB", "LS", "LY", "LI", "LT", "LU", "MG", "MW", "MY", "MV", "ML", "MT", "MU", "MX", "FM", "MD", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NZ", "NI", "NE", "NG", "NU", "MK", "NO", "OM", "PK", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RO", "RU", "RW", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SK", "SI", "SB", "SO", "ZA", "KR", "ES", "LK", "SH", "VC", "SR", "SE", "CH", "TW", "TJ", "TZ", "TH", "TL", "TG", "TO", "TT", "TN", "TR", "TM", "VI", "UG", "UA", "AE", "GB", "US", "UY", "UZ", "VU", "VE", "VN", "ZM", "ZW". - * @param int $organizations_per_query_limit Parameter specifies the limit of organizations to take from one query search. Usually, there are no more than 400 organizations per one query search on Google Maps. Use more precise categories (asian restaurant, italian restaurant, etc.) to overcome this limitation. + * @param int $limit Parameter specifies the limit of organizations to take from one query search. Usually, there are no more than 400 organizations per one query search on Google Maps. Use more precise categories (asian restaurant, italian restaurant, etc.) to overcome this limitation. * @param bool $extract_contacts Parameter specifies whether the bot will scrape additional data (emails, social links, site keywords…) from companies’ websites. It increases the time of the extraction. * @param string $coordinates Parameter defines the coordinates to use along with the query. Example: "@41.3954381,2.1628662,15.1z". * @param bool $drop_duplicates Parameter specifies whether the bot will drop the same organizations from different queries. Using the parameter combines results from each query inside one big array. @@ -171,14 +171,14 @@ public function google_maps_search( * @return array request/task result */ public function google_maps_search_v2( - string|array $query, string $language = "en", string $region = NULL, int $organizations_per_query_limit = 400, + string|array $query, string $language = "en", string $region = NULL, int $limit = 400, string $coordinates = NULL, bool $drop_duplicates = FALSE, int $skip = 0 ) : array { $params = http_build_query(array( "query" => $this->to_array($query), "language" => $language, "region" => $region, - "organizationsPerQueryLimit" => $organizations_per_query_limit, + "organizationsPerQueryLimit" => $limit, "coordinates" => $coordinates, "dropDuplicates" => $drop_duplicates, "skipPlaces" => $skip, @@ -194,8 +194,8 @@ public function google_maps_search_v2( * @param string|array $query Parameter defines the query or queries you want to search on Google Maps. Using an array allows multiple queries to be sent in one request and save on network latency time. * @param string $language Parameter specifies the language to use for Google. Available values: "en", "de", "es", "es-419", "fr", "hr", "it", "nl", "pl", "pt-BR", "pt-PT", "vi", "tr", "ru", "ar", "th", "ko", "zh-CN", "zh-TW", "ja", "ach", "af", "ak", "ig", "az", "ban", "ceb", "xx-bork", "bs", "br", "ca", "cs", "sn", "co", "cy", "da", "yo", "et", "xx-elmer", "eo", "eu", "ee", "tl", "fil", "fo", "fy", "gaa", "ga", "gd", "gl", "gn", "xx-hacker", "ht", "ha", "haw", "bem", "rn", "id", "ia", "xh", "zu", "is", "jw", "rw", "sw", "tlh", "kg", "mfe", "kri", "la", "lv", "to", "lt", "ln", "loz", "lua", "lg", "hu", "mg", "mt", "mi", "ms", "pcm", "no", "nso", "ny", "nn", "uz", "oc", "om", "xx-pirate", "ro", "rm", "qu", "nyn", "crs", "sq", "sk", "sl", "so", "st", "sr-ME", "sr-Latn", "su", "fi", "sv", "tn", "tum", "tk", "tw", "wo", "el", "be", "bg", "ky", "kk", "mk", "mn", "sr", "tt", "tg", "uk", "ka", "hy", "yi", "iw", "ug", "ur", "ps", "sd", "fa", "ckb", "ti", "am", "ne", "mr", "hi", "bn", "pa", "gu", "or", "ta", "te", "kn", "ml", "si", "lo", "my", "km", "chr". * @param string $region Parameter specifies the region to use for Google. Available values: "AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AG", "AR", "AM", "AU", "AT", "AZ", "BS", "BH", "BD", "BY", "BE", "BZ", "BJ", "BT", "BO", "BA", "BW", "BR", "VG", "BN", "BG", "BF", "BI", "KH", "CM", "CA", "CV", "CF", "TD", "CL", "CN", "CO", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "EE", "ET", "FJ", "FI", "FR", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GT", "GG", "GY", "HT", "HN", "HK", "HU", "IS", "IN", "ID", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KW", "KG", "LA", "LV", "LB", "LS", "LY", "LI", "LT", "LU", "MG", "MW", "MY", "MV", "ML", "MT", "MU", "MX", "FM", "MD", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NZ", "NI", "NE", "NG", "NU", "MK", "NO", "OM", "PK", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RO", "RU", "RW", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SK", "SI", "SB", "SO", "ZA", "KR", "ES", "LK", "SH", "VC", "SR", "SE", "CH", "TW", "TJ", "TZ", "TH", "TL", "TG", "TO", "TT", "TN", "TR", "TM", "VI", "UG", "UA", "AE", "GB", "US", "UY", "UZ", "VU", "VE", "VN", "ZM", "ZW". - * @param int $organizations_per_query_limit Parameter specifies the limit of organizations to take from one query search. Usually, there are no more than 400 organizations per one query search on Google Maps. Use more precise categories (asian restaurant, italian restaurant, etc.) to overcome this limitation. - * @param int $limit Parameter specifies the limit of reviews to extract from one organization. + * @param int $limit Parameter specifies the limit of organizations to take from one query search. Usually, there are no more than 400 organizations per one query search on Google Maps. Use more precise categories (asian restaurant, italian restaurant, etc.) to overcome this limitation. + * @param int $reviews_limit Parameter specifies the limit of reviews to extract from one organization. * @param string $coordinates Parameter defines the coordinates to use along with the query. Example: "@41.3954381,2.1628662,15.1z". * @param int $cutoff Parameter specifies the maximum timestamp value for reviews. Using the cutoff parameter overwrites sort parameter to newest. * @param int $cutoffRating Parameter specifies the maximum (for lowest_rating sorting) or minimum (for highest_rating sorting) rating for reviews. Using the cutoffRating requires sorting to be set to "lowest_rating" or "highest_rating". @@ -205,16 +205,16 @@ public function google_maps_search_v2( * @return array request/task result */ public function google_maps_reviews( - string|array $query, string $language = "en", string $region = NULL, int $organizations_per_query_limit = 1, - int $limit = 100, string $coordinates = NULL, int $cutoff = NULL, int $cutoff_rating = NULL, + string|array $query, string $language = "en", string $region = NULL, int $limit = 1, + int $reviews_limit = 100, string $coordinates = NULL, int $cutoff = NULL, int $cutoff_rating = NULL, string $sort = "most_relevant", string $reviews_query = NULL ) : array { $params = http_build_query(array( "query" => $this->to_array($query), "language" => $language, "region" => $region, - "organizationsPerQueryLimit" => $organizations_per_query_limit, - "reviewsPerOrganizationLimit" => $limit, + "organizationsPerQueryLimit" => $limit, + "reviewsPerOrganizationLimit" => $reviews_limit, "coordinates" => $coordinates, "cutoff" => $cutoff, "cutoffRating" => $cutoff_rating, @@ -231,8 +231,8 @@ public function google_maps_reviews( * @param string|array $query Parameter defines the query or queries you want to search on Google Maps. Using an array allows multiple queries to be sent in one request and save on network latency time. * @param string $language Parameter specifies the language to use for Google. Available values: "en", "de", "es", "es-419", "fr", "hr", "it", "nl", "pl", "pt-BR", "pt-PT", "vi", "tr", "ru", "ar", "th", "ko", "zh-CN", "zh-TW", "ja", "ach", "af", "ak", "ig", "az", "ban", "ceb", "xx-bork", "bs", "br", "ca", "cs", "sn", "co", "cy", "da", "yo", "et", "xx-elmer", "eo", "eu", "ee", "tl", "fil", "fo", "fy", "gaa", "ga", "gd", "gl", "gn", "xx-hacker", "ht", "ha", "haw", "bem", "rn", "id", "ia", "xh", "zu", "is", "jw", "rw", "sw", "tlh", "kg", "mfe", "kri", "la", "lv", "to", "lt", "ln", "loz", "lua", "lg", "hu", "mg", "mt", "mi", "ms", "pcm", "no", "nso", "ny", "nn", "uz", "oc", "om", "xx-pirate", "ro", "rm", "qu", "nyn", "crs", "sq", "sk", "sl", "so", "st", "sr-ME", "sr-Latn", "su", "fi", "sv", "tn", "tum", "tk", "tw", "wo", "el", "be", "bg", "ky", "kk", "mk", "mn", "sr", "tt", "tg", "uk", "ka", "hy", "yi", "iw", "ug", "ur", "ps", "sd", "fa", "ckb", "ti", "am", "ne", "mr", "hi", "bn", "pa", "gu", "or", "ta", "te", "kn", "ml", "si", "lo", "my", "km", "chr". * @param string $region Parameter specifies the region to use for Google. Available values: "AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AG", "AR", "AM", "AU", "AT", "AZ", "BS", "BH", "BD", "BY", "BE", "BZ", "BJ", "BT", "BO", "BA", "BW", "BR", "VG", "BN", "BG", "BF", "BI", "KH", "CM", "CA", "CV", "CF", "TD", "CL", "CN", "CO", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "EE", "ET", "FJ", "FI", "FR", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GT", "GG", "GY", "HT", "HN", "HK", "HU", "IS", "IN", "ID", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KW", "KG", "LA", "LV", "LB", "LS", "LY", "LI", "LT", "LU", "MG", "MW", "MY", "MV", "ML", "MT", "MU", "MX", "FM", "MD", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NZ", "NI", "NE", "NG", "NU", "MK", "NO", "OM", "PK", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RO", "RU", "RW", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SK", "SI", "SB", "SO", "ZA", "KR", "ES", "LK", "SH", "VC", "SR", "SE", "CH", "TW", "TJ", "TZ", "TH", "TL", "TG", "TO", "TT", "TN", "TR", "TM", "VI", "UG", "UA", "AE", "GB", "US", "UY", "UZ", "VU", "VE", "VN", "ZM", "ZW". - * @param int $organizations_per_query_limit Parameter specifies the limit of organizations to take from one query search. Usually, there are no more than 400 organizations per one query search on Google Maps. Use more precise categories (asian restaurant, italian restaurant, etc.) to overcome this limitation. - * @param int $limit Parameter specifies the limit of reviews to extract from one organization. + * @param int $limit Parameter specifies the limit of organizations to take from one query search. Usually, there are no more than 400 organizations per one query search on Google Maps. Use more precise categories (asian restaurant, italian restaurant, etc.) to overcome this limitation. + * @param int $reviews_limit Parameter specifies the limit of reviews to extract from one organization. * @param string $coordinates Parameter defines the coordinates to use along with the query. Example: "@41.3954381,2.1628662,15.1z". * @param int $cutoff Parameter specifies the maximum timestamp value for reviews. Using the cutoff parameter overwrites sort parameter to newest. * @param int $cutoffRating Parameter specifies the maximum (for lowest_rating sorting) or minimum (for highest_rating sorting) rating for reviews. Using the cutoffRating requires sorting to be set to "lowest_rating" or "highest_rating". @@ -242,16 +242,16 @@ public function google_maps_reviews( * @return array request/task result */ public function google_maps_reviews_v3( - string|array $query, string $language = "en", string $region = NULL, int $organizations_per_query_limit = 1, - int $limit = 100, string $coordinates = NULL, int $cutoff = NULL, int $cutoff_rating = NULL, + string|array $query, string $language = "en", string $region = NULL, int $limit = 1, + int $reviews_limit = 100, string $coordinates = NULL, int $cutoff = NULL, int $cutoff_rating = NULL, string $sort = "most_relevant", string $reviews_query = NULL ) : array { $params = http_build_query(array( "query" => $this->to_array($query), "language" => $language, "region" => $region, - "organizationsPerQueryLimit" => $organizations_per_query_limit, - "reviewsPerOrganizationLimit" => $limit, + "organizationsPerQueryLimit" => $limit, + "reviewsPerOrganizationLimit" => $reviews_limit, "coordinates" => $coordinates, "cutoff" => $cutoff, "cutoffRating" => $cutoff_rating,