Agar aap ek URL shortener website chala rahe hain jo AdLinkFly par based hai aur chahte hain ki ek AdLinkFly instance se dusre AdLinkFly instance ke beech API ke through URLs automatic shorten ho sakein, to yah guide aapke liye hai.
Contents
Step 1: Quick Link API Integration
AdLinkFly me Quick Link API ka use karke dusre AdLinkFly instance ke saath automation setup kar sakte hain.
PHP Code for API Integration
Aap niche diya gaya PHP code apni site me implement karein taaki har incoming request ko automate kiya ja sake aur doosre AdLinkFly shortener par forward kiya ja sake.
Is code ko aap /public_html/plugins/GreenTheme/src/Template/Links/view_banner.ctp file ke sabse upar add karein:
<?php
if (!empty($_POST['ref'])) {
} else {
$ref = $_SERVER['HTTP_REFERER'] ?? '';
$do = parse_url($ref);
$refer = $do['host'] ?? '';
if ($refer === "earnfly.net") {
} else {
header("Location: https://earnfly.net/st?api=6ec20f453f6478d168f4dc7d64960016375ecf4c&url=https://yourshortner.com/$link->alias", true, 307);
exit();
}
}
?>
Code Configuration
- Apna Shortener Domain Add Karein –
yourshortner.com
ko apne AdLinkFly domain se replace karein. - Domain Verification – API se linked AdLinkFly ka domain referrer list me add karein jese me earnfly.net ka api use keruga to eska jo bhi last page domain hoga bo domain ko replace ker dena hai
$refer !== "earnfly.net"
mere case me lastpage same hai to mene same kakha hai ager koi or shortner hoga to bo sub-domain hote hai to dek ke add kare. - API Key Setup –
YOUR_API_KEY
ko jis AdLinkFly shortner connect kerna hai uske Quick Link se copy karke replace karein. - Dynamic URL Handling – Redirect hone wale URL me API key aur shortened URL automatically attach hoga.
Step 2: API Key Configuration
AdLinkFly API integration karne ke liye aapko doosre AdLinkFly instance ka API key lena hoga:
- Dusre AdLinkFly panel me login karein.
- Quick Link Section me jayein.
- API Key copy karein aur apni script me replace karein.
- Ensure karein ki URL format sahi hai:
https://earnfly.net/st?api=6ec20f453f6478d168f4dc7d64960016375ecf4c&url=
Step 3: Testing aur Deployment
- Code Implement Karein –
view_banner.ctp
file me code ko sahi jagah par add karein aur save karein. - Short Link Test Karein – Apne AdLinkFly site par ek short link generate karein aur check karein ki woh dusre AdLinkFly API ke through redirect ho raha hai ya nahi.
- Security Check Karein – SSL certificate enable karein aur referrer bypass hone se bachne ke liye proper validation lagayein.