Integrations › PHP
Zapi for PHP
Call any source from PHP with the curl extension: one key, one URL shape, JSON back. No SDK to install.
- 01Check that curl is on
Most PHP builds ship with the curl extension. This prints curl if yours has it.
php -m | grep curl
- 02Set your API key
Create a free key in the dashboard and keep it out of your code.
export ZAPI_KEY="zpi_..."
- 03Call any source
Every source is a GET on /v1/<category>:<source>/<endpoint>. Decode the JSON and read data.
<?php $url = "https://api.zapi.ink/v1/social-media:tiktok-scraper/profile?" . http_build_query(["username" => "tiktok"]); $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ["x-api-key: " . getenv("ZAPI_KEY")], CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60, ]); $body = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); $json = json_decode($body, true); echo $json["data"]["followerCount"];
- 04Handle limits
A 429 means you hit your plan’s per-minute limit. Wait a moment and try again.
if ($status === 429) { // per-minute limit reached: wait, then retry sleep(5); }
The response
200 OK{
"project": "social-media:tiktok-scraper:profile",
"data": {
"username": "tiktok",
"nickname": "TikTok",
"verified": true,
"followerCount": 92400000,
"videoCount": 1310
},
"timestamp": "2026-12-01T07:00:00.000Z"
}Questions
Is there a PHP SDK?
No. One GET request with a header is all it takes, so curl is enough. JavaScript and TypeScript have zpi-sdk.
Can I use Guzzle or Laravel’s HTTP client?
Yes. Send a GET to the same URL with the x-api-key header and read data from the JSON body.
Does the key have to go in x-api-key?
No. An Authorization: Bearer header with the same key works too.
Your first call in a minute.
Free key, every source, and the same JSON shape from anywhere.