Skip to content

Revisiting LinkedIn HTTP status code 999 #557

Open
@markfullmer

Description

@markfullmer

Summary

This problem was previously discussed in 2016 in #161 , but at this point in time it might be worth revisiting. As stated in that issue, LinkedIn will return the nonstandard HTTP status code of 999 for many requests. The workaround suggested relates to code that has changed since 2016.

At a minimum, could updated syntax for how passing the ACCEPT_ENCODING should be used in the CurlClient() class. Something along the lines of the following?

    $client = new CurlClient();
    $client->setSettings([
      'user_agent' => 'Mozilla',
      'httpheader' => [
        'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
        'Accept-Enconding' => 'gzip, deflate, sdch'
      ],
    ]);

    $embed = new Embed(new Crawler($client));

Alternatively, a simple intervention could be done by this library by substituting the nonstandard 999 Forbidden for 403 Forbidden in CurlDispatcher:

        $response = $responseFactory->createResponse($info['http_code']);
+        if ($info['http_code'] === 999) [
+            $info['http_code'] = 403;
+        ]
        foreach ($this->headers as $header) {
            list($name, $value) = $header;
            $response = $response->withAddedHeader($name, $value);
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions