zoonman
zoonman

Reputation: 1163

How to avoid "HTTP/1.1 999 Request denied" response from LinkedIn?

I'm making request to LinkedIn page and receiving "HTTP/1.1 999 Request denied" response. I use AWS/EC-2 and get this response. On localhost everything works fine.

This is sample of my code to get html-code of the page.

<?php
error_reporting(E_ALL);
$url= 'https://www.linkedin.com/pulse/5-essential-strategies-digital-michelle';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
var_dump($response);
var_dump($info); 

I don't need whole page content, just meta-tags (title, og-tags).

Upvotes: 5

Views: 35038

Answers (4)

Mike Veazie - MSFT
Mike Veazie - MSFT

Reputation: 916

I ran into this while doing local web development and using the LinkedIn badge feature (profile.js). I was only getting the 999 Request denied in Chrome, so I just cleared my browser cache and localStorage and it started to work again.

UPDATE - Clearing cache was just a coincidence and the issue came back. LinkedIn is having issues with their badge functionality.

I submitted a help thread to their forums. https://www.linkedin.com/help/linkedin/forum/question/714971

Upvotes: 1

Ondřej Bleha
Ondřej Bleha

Reputation: 41

<?php
header("Content-Type: text/plain");

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.linkedin.com/company/technistone-a-s-");

$header = array();
$header[] = "Host: www.linkedin.com";
$header[] = "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0";
$header[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
$header[] = "Accept-Language: en-US,en;q=0.5";
$header[] = "Accept-Encoding: gzip, deflate, br";
$header[] = "Connection: keep-alive";
$header[] = "Upgrade-Insecure-Requests: 1";

curl_setopt($ch,CURLOPT_ENCODING , "gzip");
curl_setopt($ch, CURLOPT_HTTPHEADER , $header);
$my_var = curl_exec($ch);

echo $my_var;

Upvotes: 4

Kaleem
Kaleem

Reputation: 41

LinkedIn is not supporting the default encoding 'identity' , so if you set the header

'Accept-Encoding': 'gzip, deflate'

you should get the response , but you would have to decompress it.

Upvotes: 1

Korvo
Korvo

Reputation: 9754

Note that the error 999 don't exist in W3C Hypertext Transfer Protocol - HTTP/1.1, probably this error is customized (sounds like a joke)

LinkedIn don't allow direct access, the probable reason of them blocking any "url" from others webservers access should be to:

  1. Prevent unauthorized copying of information
  2. Prevent invasions
  3. Prevent abuse of requests.
  4. Force use API

Some IP addresses of servers are blocked, as the "IP" from "domestic ISP" are not blocked and that when you access the LinkedIn with web-browser you use the IP of your internet provider.

The only way to access the data is to use their APIs. See:

Note: The search engines like Google and Bing probably have their IPs in a "whitelist".

Upvotes: 7

Related Questions