PHP Classes

Not possible to retrieve the API Call issue

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement PHP ...  >  All threads  >  Not possible to retrieve the API...  >  (Un) Subscribe thread alerts  
Subject:Not possible to retrieve the API...
Summary:Not possible to retrieve the API Call issue
Messages:8
Author:Ali Baig
Date:2014-08-27 00:12:32
 

  1. Not possible to retrieve the API...   Reply   Report abuse  
Picture of Ali Baig Ali Baig - 2014-08-27 00:12:32
I'm getting this error, "it was not possible to retrieve the API call: it was exceeded the limit of request redirection".
I am unable to resolve the issue. What might have been causing this?

  2. Re: Not possible to retrieve the API...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-08-27 04:31:06 - In reply to message 1 from Ali Baig
That maybe it is an issue with calling an API with the incorrect address, that causes infinite or very high number of redirection.

If you cannot figure the problem with API call URL, try setting the debug variable to true, enable PHP error log to go to a given file, and paste the output of your PHP error log file here so we can try to figure what may be wrong.

  3. Re: Not possible to retrieve the API...   Reply   Report abuse  
Picture of Ali Baig Ali Baig - 2014-08-27 07:37:25 - In reply to message 2 from Manuel Lemos
I have echo out the final url just before he API Call, 'https://www.odesk.com/api/profiles/v1/jobs/~0182fccefb2cc01670%3b~014897b80f5fac2b3e%3b~012c7222648101aa0c%3b~014fc3ccf4187ecbee%3b~01fb899360141771d3%3b~01b651b2b7f90b6242%3b~0102386d51e3dd8f3a%3b~01f00ef568bec570d1%3b~0195a09f42a01ea89f%3b~019928c219c34fee1a%3b~01b004b9209808d491%3b~01ee691fd5906efad9%3b~019a8b08e4d1133648%3b~012cc1a75c639c10ca%3b~013664b4be658e07fd%3b~011685ada4ba7a3804%3b~01e0b41db6e55f8ede%3b~01577753dfec82bf6e.json' and when i open it in browser it displays the correct results. But gives an error when i call it from APICall.

  4. Re: Not possible to retrieve the API...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-08-27 07:58:58 - In reply to message 3 from Ali Baig
I have tried it here and it works.

By default the class uses sessions to store tokens but sessions only work when the user is present in a real browser. Could you be trying to access the API from command line script rather than a browser?

  5. Re: Not possible to retrieve the API...   Reply   Report abuse  
Picture of Ali Baig Ali Baig - 2014-08-27 08:51:20 - In reply to message 4 from Manuel Lemos
Yeah, it's a browser based script, I have called 3 more different URL's from CallAPI(..) function and they are working fine. $client may be damaged in a scope where i'm trying to call. I'm calling this from just above $client->Finalize(..) method.

  6. Re: Not possible to retrieve the API...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-08-27 09:25:53 - In reply to message 5 from Ali Baig
You may want to try setting the debug variable to true and show the PHP error log here, so I may analyze and see what you may be doing differently.

  7. Re: Not possible to retrieve the API...   Reply   Report abuse  
Picture of Ali Baig Ali Baig - 2014-08-28 11:03:07 - In reply to message 6 from Manuel Lemos
I'm writing to a log file but it doesn't contain any error. But when i
"echo $client->error;" It shows the following on browser.

"it was not possible to retrieve the API call: it was exceeded the limit of request redirections
it was not possible to retrieve the API call: it was exceeded the limit of request redirections
it was not possible to retrieve the API call: it was exceeded the limit of request redirections"

After i explore http.php @line1665, following was found
$this->redirection_level++;
if($this->redirection_level>$this->redirection_limit)
{
$error="it was exceeded the limit of request redirections";
$this->error_code = HTTP_CLIENT_ERROR_PROTOCOL_FAILURE;
}

I believe this is something related to the issue. Any more help please Sir

  8. Re: Not possible to retrieve the API...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-08-28 11:36:41 - In reply to message 7 from Ali Baig
Yes, the redirection may be in an infinite loop, but if you do not show what appears in the error log, I have no idea what is that loop.