The "999" Status Code: Why LinkedIn Rejects HEAD Requests from Servers
When verifying external links in a PHP application, using curl to inspect HTTP status codes is a standard practice. However, LinkedIn has historically treated automated HEAD requests differently than standard browser traffic. If you are seeing an HTTP/1.1 999 Request denied response on Ubuntu servers while the same request succeeds locally on a Mac, the issue isn't your PHP logic; it's how LinkedIn's Anti-Traffic System (ATS) classifies the incoming connection.
The core problem stems from the combination of three factors: the HTTP method used (HEAD), the source IP address range, and the absence of specific client characteristics. LinkedIn does not return a standard error code like 403 or 429 for these automated probes; instead, they utilize a custom status code, 999, specifically to signal that the request was blocked by their security infrastructure.
The Anatomy of the Rejection
The sample response header provided in the report illustrates exactly what you are dealing with:
HTTP/1.1 999 Request denied
Date: Tue, 18 Nov 2014 23:20:48 GMT
Server: ATS
X-Li-Pop: prod-lva1
Content-Length: 956
Content-Type: text/html
The presence of the ATS (Anti-Traffic System) header is the smoking gun. This indicates that LinkedIn's server-side firewall intercepted the request before it reached the application logic. The system recognizes the request as non-human traffic and immediately terminates the handshake with a custom rejection code.
Crucially, this behavior is not mitigated by simple User-Agent spoofing. As noted in the troubleshooting logs, switching from a "Mac UA" to a "Windows UA" on an Ubuntu server yields no improvement. LinkedIn's ATS likely correlates the source IP address against known datacenter ranges (such as AWS, DigitalOcean, or specific hosting providers). If your Ubuntu server resides in a public cloud environment, you are almost certainly being flagged based on your IP reputation alone.
Why Local Machines Work Differently
The discrepancy between local development environments and production servers highlights a fundamental misunderstanding of how these blocks function. On a local machine (whether native Mac or a VM running inside one), the IP address is typically a residential broadband connection. These IPs are not associated with high-volume server farms, so they pass through the initial ATS filter.
Furthermore, local browsers often include additional headers beyond the User-Agent that mimic human behavior more closely, such as specific TLS fingerprinting or timing characteristics that curl defaults do not replicate. Even if you force a local Mac to send a "Windows UA" via curl, the underlying IP reputation usually allows the request through initially, giving the ATS a chance to inspect the content. On a server-side Ubuntu instance, the IP block is immediate and absolute.
Solutions for Server-Side Validation
If you need to validate LinkedIn links from an Ubuntu machine within a PHP application, relying on curl with a simple HEAD request will continue to fail regardless of User-Agent manipulation. The 999 status code is a hard stop designed to prevent exactly this type of bulk link checking.
There are three viable approaches to resolve this:
1. Use the Official API
The most robust solution is to integrate with LinkedIn's official APIs if your use case allows for it. While they do not have a generic "validate any URL" endpoint, their Search API or specific company search endpoints can verify existence without triggering the ATS. This requires an application key and adheres to their rate limits, but it returns legitimate JSON rather than HTML headers.
2. Switch to GET with Timeout Logic
If you must check a raw URL, switch your request from HEAD to GET. While LinkedIn still may block datacenter IPs, a GET request attempts to fetch the document. If the link is valid, you get a 200 OK. If it is broken, you might receive a 404 Not Found.
However, be aware that LinkedIn often serves a "Page Not Found" HTML page for invalid links even before blocking them entirely. You can catch this by fetching the content and checking for specific error strings in the body, provided your server's connection timeout is set high enough to handle the redirect chain LinkedIn might employ.
$ch = curl_init("https://www.linkedin.com/company/linkedin");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Prevent hanging on redirects
curl_setopt($ch, CURLOPT_NOBODY, false); // Switch from HEAD to GET
$response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($response_code === 200) {
echo "Link is valid.";
} elseif ($response_code === 404) {
echo "Company page not found (404).";
} else if ($response_code === 999) {
// Still blocked by ATS. No amount of headers will fix this without an IP change.
echo "Request denied by LinkedIn security.";
}
curl_close($ch);
3. Rotate Residential Proxies
If the business requirement demands checking millions of links and you cannot use the API, the only technical workaround is to route your traffic through residential proxy networks (e.g., BrightData, Smartproxy). These services provide IPs that appear as residential users rather than datacenter servers. By masking the source IP, you bypass the ATS check entirely.
This approach introduces cost and complexity regarding proxy management but is the only way to force a curl HEAD request to return a 200 OK from LinkedIn when originating from a server environment.