PHP integration
Block disposable emails in PHP
You're running a PHP app and fake signups keep getting through. Add one request to your registration code and Fidro checks the email and IP before the account exists.
How it works
Send the user's email and IP to Fidro with Guzzle, or any PHP HTTP client. Fidro checks the address, the network and what it has already seen from them, then answers allow, challenge or block in a single JSON response. No SDK needed.
One fake signup can look perfectly normal. Five from the same IP in an hour don't. Send event and user_id with each call and Fidro remembers, so it catches the pattern as well as the person. You get a score from 0 to 100 and one answer: allow, challenge or block.
1. Install what you need
composer require guzzlehttp/guzzle
You'll also need an API key. Sign up free and you'll have one in a minute, no card needed.
2. Check every signup
Send the email and IP to POST /api/validate. Fidro checks for disposable domains, missing mail servers, VPNs, proxies and Tor, and answers allow, challenge or block. Let the allows straight in, ask the challenges to confirm their email, and turn the blocks away.
<?php
require_once 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client(['timeout' => 5]);
try {
$response = $client->post('https://fidro.io/api/validate', [
'headers' => ['Authorization' => 'Bearer ' . getenv('FIDRO_API_KEY')],
'json' => [
'email' => 'test@example.com',
'ip' => '8.8.8.8',
'event' => 'signup',
],
]);
$result = json_decode($response->getBody(), true);
echo 'Risk score: ' . $result['risk_score'] . PHP_EOL; // 0 to 100
echo 'Recommendation: ' . $result['recommendation'] . PHP_EOL; // allow, challenge or block
if ($result['recommendation'] === 'block') {
// Refuse the signup
}
} catch (RequestException $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
}
3. Look up an IP
Just want to know where a request came from? GET /api/ip/{ip} returns the country, city, ISP and network, without scoring. The VPN, proxy and Tor flags come from /api/validate, under data.checks.
<?php
require_once 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client(['timeout' => 5]);
try {
$response = $client->get('https://fidro.io/api/ip/8.8.8.8', [
'headers' => ['Authorization' => 'Bearer ' . getenv('FIDRO_API_KEY')],
]);
$result = json_decode($response->getBody(), true);
echo 'Country: ' . $result['location']['country_name'] . PHP_EOL;
echo 'ISP: ' . $result['location']['isp'] . PHP_EOL;
} catch (RequestException $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
}
Want to see real results first? Try any address in the free IP checker.
Next steps
The API reference has every field. The free checker shows you real results. And if you're weighing up alternatives, the comparisons are honest about where others fit.
Frequently Asked Questions
How do I add fraud detection to PHP?
Does Fidro have a PHP SDK?
Is Fidro free to use with PHP?
What should I do when Fidro says challenge?
Start catching bad signups in the next 5 minutes
Create your account, grab your API key, and send your first request. Free plan with 200 validations/month. No credit card. Cancel anytime.