sharpapi/php-content-url-detector

Detect URLs in text using AI - extracts and validates URLs

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/sharpapi/php-content-url-detector

v1.0.1 2026-01-09 15:37 UTC

This package is auto-updated.

Last update: 2026-01-10 14:19:33 UTC


README

SharpAPI GitHub cover

Content Url Detector API for PHP

📝 Detect URLs in text using AI - extracts and validates URLs

Latest Version on Packagist Total Downloads

Check the full documentation on the Content Url Detector API for PHP API page.

Quick Links

Resource Link
Main API Documentation Authorization, Webhooks, Polling & More
Postman Documentation View Docs
Product Details SharpAPI.com
SDK Libraries GitHub - SharpAPI SDKs

Requirements

  • PHP >= 8.0

Installation

Step 1. Install the package via Composer:

composer require sharpapi/php-content-url-detector

Step 2. Visit SharpAPI to get your API key.

Laravel Integration

Building a Laravel application? Check the Laravel package version for better integration.

What it does

Detect URLs in text using AI - extracts and validates URLs

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

use SharpAPI\ContentUrl\UrlDetectorClient;
use GuzzleHttp\Exception\GuzzleException;

$apiKey = 'your_api_key_here';
$client = new UrlDetectorClient(apiKey: $apiKey);

try {
    $statusUrl = $client->detectUrls(
        content: 'Your text content here',
        language: 'English'
    );

    // Optional: Configure polling
    $client->setApiJobStatusPollingInterval(10);
    $client->setApiJobStatusPollingWait(180);

    // Fetch results (polls automatically)
    $result = $client->fetchResults($statusUrl);
    $resultData = $result->getResultJson();

    echo $resultData;
} catch (GuzzleException $e) {
    echo "API error: " . $e->getMessage();
}

Example Response

{
    "data": {
        "type": "api_job_result",
        "id": "4b9035d5-27ad-401a-ab15-46d398ca7025",
        "attributes": {
            "status": "success",
            "type": "content_detect_urls",
            "result": [
                {
                    "url": "http://example.com",
                    "protocol": "http"
                },
                {
                    "url": "https://example.com",
                    "protocol": "https"
                },
                {
                    "url": "ftp://example.com",
                    "protocol": "ftp"
                },
                {
                    "url": "sftp://example.com",
                    "protocol": "sftp"
                },
                {
                    "url": "ftps://example.com",
                    "protocol": "ftps"
                },
                {
                    "url": "mailto:someone@example.com",
                    "protocol": "mailto"
                },
                {
                    "url": "tel:+1234567890",
                    "protocol": "tel"
                },
                {
                    "url": "file:///C:/path/to/file",
                    "protocol": "file"
                },
                {
                    "url": "ws://example.com",
                    "protocol": "ws"
                },
                {
                    "url": "wss://example.com",
                    "protocol": "wss"
                },
                {
                    "url": "gopher://example.com",
                    "protocol": "gopher"
                },
                {
                    "url": "irc://irc.example.com",
                    "protocol": "irc"
                },
                {
                    "url": "ircs://irc.example.com",
                    "protocol": "ircs"
                },
                {
                    "url": "magnet:?xt=urn:btih:...",
                    "protocol": "magnet"
                },
                {
                    "url": "smb://example.com/share",
                    "protocol": "smb"
                },
                {
                    "url": "nfs://example.com/path",
                    "protocol": "nfs"
                },
                {
                    "url": "ssh://user@example.com",
                    "protocol": "ssh"
                },
                {
                    "url": "rtsp://example.com",
                    "protocol": "rtsp"
                },
                {
                    "url": "vpn://example.com",
                    "protocol": "vpn"
                },
                {
                    "url": "about:blank",
                    "protocol": "about"
                },
                {
                    "url": "chrome://settings",
                    "protocol": "chrome"
                },
                {
                    "url": "edge://settings",
                    "protocol": "edge"
                },
                {
                    "url": "javascript:alert('Hello');",
                    "protocol": "javascript"
                },
                {
                    "url": "ldap://example.com",
                    "protocol": "ldap"
                },
                {
                    "url": "ldaps://example.com",
                    "protocol": "ldaps"
                },
                {
                    "url": "urn:isbn:0451450523",
                    "protocol": "urn"
                },
                {
                    "url": "gemini://example.com",
                    "protocol": "gemini"
                },
                {
                    "url": "sip:user@example.com",
                    "protocol": "sip"
                },
                {
                    "url": "sips:user@example.com",
                    "protocol": "sips"
                },
                {
                    "url": "callto://+1234567890",
                    "protocol": "callto"
                },
                {
                    "url": "web+myapp://example",
                    "protocol": "web+"
                },
                {
                    "url": "ms-word:ofe|u|https://example.com/doc.docx",
                    "protocol": "ms-word"
                },
                {
                    "url": "zoommtg://zoom.us/join?confno=123456789",
                    "protocol": "zoom"
                },
                {
                    "url": "msteams://example.com",
                    "protocol": "msteams"
                },
                {
                    "url": "slack://open?team=example",
                    "protocol": "slack"
                },
                {
                    "url": "itms://itunes.apple.com/...",
                    "protocol": "itms"
                },
                {
                    "url": "maps://?q=1600+Amphitheatre+Parkway",
                    "protocol": "maps"
                },
                {
                    "url": "ms-web://example.com",
                    "protocol": "ms-web"
                },
                {
                    "url": "news:comp.lang.python",
                    "protocol": "news"
                },
                {
                    "url": "nntp://news.example.com",
                    "protocol": "nntp"
                },
                {
                    "url": "intent://scan/#Intent;...",
                    "protocol": "android"
                },
                {
                    "url": "paypal://",
                    "protocol": "paypal"
                },
                {
                    "url": "vnc://example.com",
                    "protocol": "vnc"
                },
                {
                    "url": "tor://example.onion",
                    "protocol": "tor"
                },
                {
                    "url": "ed2k://|file|...",
                    "protocol": "ed2k"
                },
                {
                    "url": "secondlife://Region/128/128/0",
                    "protocol": "second-life"
                },
                {
                    "url": "aaa://",
                    "protocol": "aaas"
                }
            ]
        }
    }
}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

License: MIT

The MIT License (MIT). Please see License File for more information.

Social Media

🚀 For the latest news, tutorials, and case studies, don't forget to follow us on: