|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-06-05 01:52 UTC] davidshumway at gmail dot com
Description: ------------ The specific request is for linkedin.com. It is http://api.linkedin.com/v1/company-search? sort=relevance&facet=location,us:84&facet=industry,4. The two instances of "facet" are supposed to be supported. The response returned is: Error: Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect) Response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <error> <status>401</status> <timestamp>1370387652196</timestamp> <request-id>[redacted]</request-id> <error-code>0</error-code> <message>[unauthorized]. OAU:[redacted]</message> </error> #php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Scan for additional .ini files in: /etc/php.d Additional .ini files parsed: /etc/php.d/curl.ini, /etc/php.d/fileinfo.ini, /etc/php.d/json.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/oauth.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_sqlite.ini, /etc/php.d/phar.ini, /etc/php.d/pspell.ini, /etc/php.d/sqlite3.ini, /etc/php.d/zip.ini #php -m [PHP Modules] bz2 calendar Core ctype curl date ereg exif fileinfo filter ftp gettext gmp hash iconv json libxml mhash mysql mysqli OAuth openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar pspell readline Reflection session shmop SimpleXML sockets SPL sqlite3 standard tokenizer xml zip zlib Test script: --------------- // This is a simple request to linkedin.com's API. An API key is required. $consumer_key = '<enter a key>'; $consumer_secret = '<enter a key>'; $o = new OAuth($consumer_key, $consumer_secret); $o->setToken('<enter a key>', '<enter a key>'); $url = 'http://api.linkedin.com/v1/company-search?sort=relevance&facet=location,us:84&facet=industry,4'; echo $o->fetch( $url ); Expected result: ---------------- The request is supposed to complete successfully. Actual result: -------------- The response returned is: Error: Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect) Response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <error> <status>401</status> <timestamp>1370387652196</timestamp> <request-id>[redacted]</request-id> <error-code>0</error-code> <message>[unauthorized]. OAU:[redacted]</message> </error> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 06:00:01 2025 UTC |
Hi, i think i found the solution: Put your facet params in array $params like: $params = array( "facet" => array("location,us:84","industry,4'"); } and then put this $params into fetch args: $res_fetch=$oauth->fetch($url, $params, OAUTH_HTTP_METHOD_GET,array('x-li- format' => 'json'));