tienphat / serpscraper-php
Official PHP client for SerpScraper.Dev โ real-time Google & Bing search results API, AI Overviews, Google Trends, and Web Scraping.
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Official multi-language client libraries for SerpScraper.Dev โ The high-speed SERP API designed for developers, SEO platforms, and AI agents.
Scrape real-time Google & Bing search rankings, parse Google AI Overviews, track Google Trends, and extract web intelligence as clean, structured JSON.
๐ Why Choose SerpScraper?
SerpScraper.Dev is built from the ground up for modern developers, LLM engineers, and SEO specialists who require reliable search data at scale:
- โก Sub-Second Response Times: Engineered with distributed high-performance edge nodes for ultra-fast query execution.
- ๐ก๏ธ Zero Block Guarantee: Built-in rotating residential and datacenter proxies completely bypass Cloudflare, Akamai, Google reCAPTCHA, and bot detection systems.
- ๐ค Native Google AI Overview Extraction: Directly extract synthesized AI answers, citation cards, and source links via the Google AI Overview API โ perfect for RAG and AI search workflows.
- ๐ Real-Time Google Trends: Monitor breaking news, trending searches, and historical search volume timelines with the Google Trends API.
- ๐ Global Geolocation Targeting: Precise local search emulation across 190+ countries (
gl), languages (hl), and regional domains (google.co.uk,google.co.jp, etc.). - ๐ฆ Zero External Dependencies: All SDKs in this monorepo rely strictly on standard libraries (cURL, urllib, native fetch, net/http) for maximum security and zero dependency conflicts.
๐ Monorepo Structure
This repository provides official client libraries across four major programming languages:
serpscraper/
โโโ php/ # ๐ PHP SDK (Composer: tienphat/serpscraper-php) -> php/README.md
โโโ python/ # ๐ Python SDK (PyPI: serpscraper-dev) -> python/README.md
โโโ nodejs/ # ๐ฉ Node.js / TypeScript SDK (npm: serpscraper) -> nodejs/README.md
โโโ go/ # ๐น Go SDK (Go Modules: .../go) -> go/README.md
โโโ composer.json # Root Composer support for backward-compatible installs
โโโ README.md
| Language | Package Manager | Installation | Detailed Guide |
|---|---|---|---|
| PHP | Packagist / Composer | composer require tienphat/serpscraper-php |
php/README.md |
| Python | PyPI / pip | pip install serpscraper-dev |
python/README.md |
| Node.js / TS | npm / yarn / pnpm | npm install serpscraper |
nodejs/README.md |
| Go | Go Modules | go get github.com/tienphat/serpscraper.dev/go |
go/README.md |
๐ Quickstarts
Grab your free API key at serpscraper.dev.
๐ 1. PHP SDK
composer require tienphat/serpscraper-php
use SerpScraper\SerpScraperClient; $client = new SerpScraperClient('YOUR_API_KEY'); // 1. Google Web Search & AI Overview $results = $client->googleSearch('best generative ai tools', ['gl' => 'US', 'hl' => 'en']); foreach ($results as $item) { echo "#{$item['position']} {$item['title']} โ {$item['link']}\n"; } if ($summary = $results->summary()) { echo "\n[Google AI Overview]:\n{$summary}\n"; } // 2. Google Trends Real-Time $trends = $client->trendsNow(['gl' => 'US']); echo "Top Trend: " . $trends->first()['keyword'] . "\n";
๐ Read the complete PHP SDK Documentation.
๐ 2. Python SDK
pip install serpscraper-dev
from serpscraper import SerpScraperClient client = SerpScraperClient("YOUR_API_KEY") # 1. Google Web Search & AI Overview results = client.google_search("best generative ai tools", gl="US", hl="en") for item in results: print(f"#{item['position']} {item['title']} โ {item['link']}") if results.summary: print(f"\n[Google AI Overview]:\n{results.summary}") # 2. Google Trends Real-Time trends = client.trends_now(gl="US") print(f"Top Trend: {trends.first['keyword']}")
๐ Read the complete Python SDK Documentation.
๐ฉ 3. Node.js & TypeScript SDK
npm install serpscraper
const { SerpScraperClient } = require('serpscraper'); const client = new SerpScraperClient('YOUR_API_KEY'); async function main() { // 1. Google Web Search & AI Overview const res = await client.googleSearch('best generative ai tools', { gl: 'US', hl: 'en' }); for (const item of res) { console.log(`#${item.position} ${item.title} โ ${item.link}`); } if (res.summary) { console.log('\n[Google AI Overview]:\n', res.summary); } // 2. Google Trends Real-Time const trends = await client.trendsNow({ gl: 'US' }); console.log('Top Trend:', trends.first?.keyword); } main();
๐ Read the complete Node.js SDK Documentation.
๐น 4. Go SDK
go get github.com/tienphat/serpscraper.dev/go
package main import ( "context" "fmt" "time" serpscraper "github.com/tienphat/serpscraper.dev/go" ) func main() { client, _ := serpscraper.NewClient("YOUR_API_KEY") ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() // 1. Google Web Search & AI Overview resp, _ := client.GoogleSearch(ctx, "best generative ai tools", serpscraper.WithGL("US"), serpscraper.WithHL("en"), ) for _, item := range resp.Data { fmt.Printf("#%d %s โ %s\n", item.Position, item.Title, item.Link) } if summary := resp.Summary(); summary != "" { fmt.Printf("\n[Google AI Overview]:\n%s\n", summary) } // 2. Google Trends Real-Time trends, _ := client.TrendsNow(ctx, serpscraper.WithGL("US")) if len(trends.Data) > 0 { fmt.Printf("Top Trend: %s\n", trends.Data[0].Keyword) } }
๐ Read the complete Go SDK Documentation.
๐ Supported APIs & Live Endpoints
All SDKs map directly to the high-performance endpoints hosted at serpscraper.dev:
| API Feature | PHP / Node / Go Method | Python Method | Landing Page & Documentation |
|---|---|---|---|
| Google Search API | googleSearch() / GoogleSearch |
google_search() |
Google Search API |
| Web Search API | webSearch() / WebSearch |
web_search() |
Web Search API (Bing / Multi-Engine) |
| Google AI Overview API | aioSearch() / AioSearch |
aio_search() |
Google AI Overview API |
| Google Trends Real-Time | trendsNow() / TrendsNow |
trends_now() |
Google Trends API |
| Google Trends Interest | trendsInterest() / TrendsInterest |
trends_interest() |
Google Trends Interest Over Time |
| Image Search API | imageSearch() / ImageSearch |
image_search() |
Image Search API |
| Video Search API | videoSearch() / VideoSearch |
video_search() |
Video Search API |
| News Search API | newsSearch() / NewsSearch |
news_search() |
News Search API |
| Shopping Search API | shoppingSearch() / ShoppingSearch |
shopping_search() |
Shopping Search API |
| Google Scholar API | scholarSearch() / ScholarSearch |
scholar_search() |
Google Scholar API |
| Google Maps API | mapsSearch() / MapsSearch |
maps_search() |
Google Maps & Places API |
| Reviews Search API | reviewsSearch() / ReviewsSearch |
reviews_search() |
Customer Reviews Search API |
| SERP Autocomplete | autocomplete() / Autocomplete |
autocomplete() |
SERP Autocomplete API |
| Webpage Extractor | extractWebpage() / ExtractWebpage |
extract_webpage() |
Webpage Content Extractor API |
| IP Geolocation API | ipLookup() / IPLookup |
ip_lookup() |
IP Geolocation & Threat API |
| Exchange Rate API | exchangeRate() / ExchangeRate |
exchange_rate() |
Fiat Exchange Rate API |
| Crypto Price API | cryptoPrice() / CryptoPrice |
crypto_price() |
Cryptocurrency Price API |
| Domain Intelligence | domainInfo() / DomainInfo |
domain_info() |
Domain Intelligence & WHOIS API |
| SEO Domain Overview | seoDomainOverview() / SEODomainOverview |
seo_domain_overview() |
SEO API docs |
| SEO Backlinks | seoBacklinks() / SEOBacklinks |
seo_backlinks() |
SEO API docs |
| Keyword Metrics | seoKeywordMetrics() / SEOKeywordMetrics |
seo_keyword_metrics() |
SEO API docs |
| Keyword Suggestions | seoKeywordSuggestions() / SEOKeywordSuggestions |
seo_keyword_suggestions() |
SEO API docs |
| Proxy API | proxySession(), proxyRotate(), proxyLocations() / Proxy* |
proxy_session(), proxy_rotate(), proxy_locations() |
Rotating Proxy API |
๐ฏ Key Use Cases
1. ๐ค AI Agents & Retrieval-Augmented Generation (RAG)
Equip LLMs (OpenAI GPT-4o, Claude 3.5, Llama 3, Gemini 1.5) with real-time web knowledge. Extract both organic sources and synthesized Google AI Overviews with zero hallucination risk.
2. ๐ SEO Rank Tracking & Competitor Intelligence
Monitor organic rankings, SERP features (Featured Snippets, People Also Ask, Local Packs), and track ranking fluctuations across 190+ countries with exact local IP emulation via the SERP API.
3. ๐ฅ Trend Detection & Market Research
Discover viral topics before competitors with real-time trending queries from the Google Trends API. Analyze multi-year historical search interest to validate product demand.
4. ๐ E-Commerce Price Monitoring & Review Aggregation
Track product prices, availability, and merchant ratings across Google Shopping with the Shopping Search API and Reviews Search API.
โ Frequently Asked Questions (FAQ)
1. How does SerpScraper bypass Google CAPTCHA and bot detection?
SerpScraper manages an enterprise-scale pool of rotating residential proxies and AI-driven anti-fingerprinting browsers. All CAPTCHA solving, IP rotation, and header spoofing are handled automatically on the server side, ensuring consistent 99.9% uptime and unblockable scraping.2. Can I parse Google AI Overviews with this SDK?
Yes! SerpScraper provides native parsing for Google AI Overviews (SGE). Every response object includes direct helper methods like$results->summary(), results.summary, or resp.Summary() to immediately extract AI-synthesized markdown text and cited references. Learn more at serpscraper.dev/google-ai-overview-api.
3. Are there any external runtime dependencies in these SDKs?
None. All SDKs are implemented with pure standard libraries: PHP cURL, Pythonurllib, Node.js native fetch, and Go net/http. This ensures zero dependency conflicts, lightweight footprints, and optimal security.
4. How do I obtain a free API key?
You can sign up and get your free API key instantly with generous monthly credits at serpscraper.dev.๐งช Testing
Unit and integration test suites are available in each respective language directory:
# 1. PHP (PHPUnit 11 โ 67 tests, 114 assertions) cd php && vendor/bin/phpunit # 2. Python (unittest โ 5 tests) cd python && python -m unittest discover -s tests # 3. Node.js (native test runner โ 2 tests) cd nodejs && npm test # 4. Go (testing package) cd go && go test -v ./...
๐ Documentation & Resources
- ๐ Official Website: https://serpscraper.dev
- ๐ API Documentation: https://serpscraper.dev/docs
- ๐ Get Free API Key: https://serpscraper.dev
- ๐ SERP API Landing Page: https://serpscraper.dev/serp-api
- ๐ค Google AI Overview API: https://serpscraper.dev/google-ai-overview-api
- ๐ Google Trends API: https://serpscraper.dev/google-trends-api
- ๐ฌ Telegram Support: @peterpanpro
- ๐ Issue Tracker: GitHub Issues
๐ License
The SerpScraper SDK Monorepo is open-sourced software licensed under the MIT License.