Skip to content

About

PHP curl client for the Google Custom Search JSON API shutdown on January 1, 2027: the same /customsearch/v1 request, plus SerpApi, Bing v7 and live web search on one key.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP client for the Google Custom Search API shutdown: SerpApi, Bing and live web search on one key

Google ends the Custom Search JSON API on January 1, 2027, and it is already closed to new customers. This PHP client, on curl and json only, sends the same /customsearch/v1 request to SpecStream, the live web data engine, and reads the same items[] back. The same key answers SerpApi and Bing Web Search v7 requests in their own shapes, and SpecStream's own Search and Extract APIs.

Method Route on https://api.specstream.ai Key goes Reply
googleCse GET /customsearch/v1 key= in the address Google's items[]
serpapi GET /serpapi/search.json api_key= in the address SerpApi's organic_results[]
bing GET /v7.0/search Ocp-Apim-Subscription-Key Bing's webPages.value[]
webSearch GET /v1/web-search Authorization: Bearer sources[]
extract POST /v1/extract Authorization: Bearer page text as Markdown
dialects, findLists GET /v1/search-dialects, GET /v1/data/lists/search no key free

Every search runs on the fast tier: $1 per 1,000 searches, 937 ms median over 6,548 live calls in the 7 days to December 1, 2026. Google's own price was $5 per 1,000 queries.

The one line

- $url = 'https://www.googleapis.com/customsearch/v1?' . http_build_query(['key' => $googleKey, 'cx' => $cx, 'q' => $q]);
+ $url = 'https://api.specstream.ai/customsearch/v1?' . http_build_query(['key' => $specstreamKey, 'q' => $q]);

cx is accepted and not used, since SpecStream searches the whole live web; write site:example.com in q to keep a search inside one site. The PHP migration guide walks through the same change with file_get_contents.

Run

git clone https://github.com/specstream/php-specstream-search
cd php-specstream-search
php bin/specstream.php check            # live, no key, nothing charged
API reachable: 70 drop-in APIs on 78 routes at https://api.specstream.ai
  Google Custom Search JSON API    replaces https://www.googleapis.com
  Bing Web Search API v7           replaces https://api.bing.microsoft.com/v7.0/search
  SerpApi                          replaces https://serpapi.com

Get a key under Agents & API at specstream.ai/workspace. A new account gets $2 of credit with no card, which is 2,000 fast searches.

export SPECSTREAM_API_KEY=your_key
php bin/specstream.php cse "best crm for startups"
php bin/specstream.php serpapi "best crm for startups"
php bin/specstream.php bing "best crm for startups"
php bin/specstream.php search "Laravel 12 release notes"
php bin/specstream.php extract https://www.php.net/releases/8.4/en.php

In your app

require 'src/ApiError.php';
require 'src/Client.php';   // or "autoload": {"psr-4": {"SpecStream\\": "src/"}} with Composer

$c = new \SpecStream\Client(); // reads SPECSTREAM_API_KEY

foreach ($c->googleCse('best crm for startups')['items'] ?? [] as $item) {
    echo $item['title'], ' ', $item['link'], "\n";
}
$page = $c->extract(['https://www.php.net/releases/8.4/en.php'])[0];
echo $page['text']; // Markdown, also from PDFs and Office files

A reply outside 2xx throws \SpecStream\ApiError; getCode() is the status and getBody() the reply in that route's own error shape, so code that reads Google's error.message or Bing's errors[].code keeps working. Checked with php -l and run live on PHP 8.4; it needs PHP 7.4 or later.

Prices

Price
Free credit on sign-up $2, which is 2,000 fast searches, no card
Fast search, every drop-in route $1 per 1,000
Extract API, page text as Markdown $0.80 per 1,000 pages
Monthly Pro Pass $49 a month: 5,000 ready list rows a month and $49 of API credit

Links

License

MIT

About

PHP curl client for the Google Custom Search JSON API shutdown on January 1, 2027: the same /customsearch/v1 request, plus SerpApi, Bing v7 and live web search on one key.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages