PHP Classes

PUT does not stop to load

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement PHP ...  >  All threads  >  PUT does not stop to load  >  (Un) Subscribe thread alerts  
Subject:PUT does not stop to load
Summary:I use PUT to set the billing state on teamviewer
Messages:15
Author:Mathias
Date:2014-08-14 11:10:01
 
  1 - 10   11 - 15  

  1. PUT does not stop to load   Reply   Report abuse  
Picture of Mathias Mathias - 2014-08-14 11:10:01
Hello,

i use PUT to set the billing state on teamviewer. It works and the billing state will set. But it donīt end to load and after a minute the server say "An internal server error occurred. Please try again later."

GET work fine and i have no problemes.

Here is my PUT-Code:
$billing = array('billing_state' => 'Billed');

$client->CallAPI('https://webapi.teamviewer.com/api/v1/reports/connections/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx','PUT',array('format'=>'json'),array('FailOnAccessError'=>true, 'RequestBody' => json_encode($billing),'RequestContentType' => 'application/json'),$billing);

The API Documentation is here http://downloadeu2.teamviewer.com/integrate/TeamViewer_API_Documentation.pdf

Is there any problem with my code?

Thanks a lot for help and sorry for my bad english
Mathias

  2. Re: PUT does not stop to load   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-08-14 20:41:13 - In reply to message 1 from Mathias
I have not tried to send it to the real API server, but the request seems to be correct.

Can you try to set the debug and debug_http variables to true and paste the output that is going to your PHP error log file? (you need to enable PHP error log file in php.ini)

  3. Re: PUT does not stop to load   Reply   Report abuse  
Picture of Mathias Mathias - 2014-08-14 21:32:48 - In reply to message 2 from Manuel Lemos
Thanks for the fast answer.
Here is the error log:

[14-Aug-2014 21:28:10 UTC] OAuth client: Checking if OAuth access token was already retrieved from https://webapi.teamviewer.com/api/v1/oauth2/token
[14-Aug-2014 21:28:10 UTC] OAuth client: The OAuth access token XXXXXX-XXXXMgaDQ2mDNn17NyW is valid
[14-Aug-2014 21:28:10 UTC] OAuth client: The OAuth access token is of type bearer
[14-Aug-2014 21:28:10 UTC] OAuth client: Accessing the API call at https://webapi.teamviewer.com/api/v1/ping
[14-Aug-2014 21:28:10 UTC] Connecting to webapi.teamviewer.com
[14-Aug-2014 21:28:10 UTC] Resolving HTTP server domain "webapi.teamviewer.com"...
[14-Aug-2014 21:28:10 UTC] Connecting to HTTP server IP XXX.XXX.XXX.XXX port 443...
[14-Aug-2014 21:28:10 UTC] Connected to webapi.teamviewer.com
[14-Aug-2014 21:28:10 UTC] C GET /api/v1/ping HTTP/1.1
[14-Aug-2014 21:28:10 UTC] C Host: webapi.teamviewer.com
[14-Aug-2014 21:28:10 UTC] C User-Agent: PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.109 $)
[14-Aug-2014 21:28:10 UTC] C Accept: */*
[14-Aug-2014 21:28:10 UTC] C Authorization: Bearer XXXXXX-XXXXMgaDQ2mDNn17NyW
[14-Aug-2014 21:28:10 UTC] C Connection: Keep-Alive
[14-Aug-2014 21:28:10 UTC] C
[14-Aug-2014 21:28:10 UTC] S HTTP/1.1 200 OK
[14-Aug-2014 21:28:10 UTC] S Cache-Control: no-cache
[14-Aug-2014 21:28:10 UTC] S Pragma: no-cache
[14-Aug-2014 21:28:10 UTC] S Content-Type: application/json; charset=utf-8
[14-Aug-2014 21:28:10 UTC] S Expires: -1
[14-Aug-2014 21:28:10 UTC] S Access-Control-Allow-Methods: POST, GET, DELETE, PUT
[14-Aug-2014 21:28:10 UTC] S Access-Control-Allow-Origin: *
[14-Aug-2014 21:28:10 UTC] S Access-Control-Allow-Headers: content-type,origin,Authorization
[14-Aug-2014 21:28:10 UTC] S Date: Thu, 14 Aug 2014 21:28:10 GMT
[14-Aug-2014 21:28:10 UTC] S Content-Length: 20
[14-Aug-2014 21:28:10 UTC] S
[14-Aug-2014 21:28:10 UTC] S {"token_valid":true}
[14-Aug-2014 21:28:10 UTC] Keeping the connection alive to webapi.teamviewer.com
[14-Aug-2014 21:28:10 UTC] OAuth client: Accessing the API call at https://webapi.teamviewer.com/api/v1/reports/connections/d96631af-XXXX-4d13-8f9c-bdcad1c4bdee
[14-Aug-2014 21:28:10 UTC] Connecting to webapi.teamviewer.com
[14-Aug-2014 21:28:10 UTC] Resolving HTTP server domain "webapi.teamviewer.com"...
[14-Aug-2014 21:28:10 UTC] Connecting to HTTP server IP XXX.XXX.XXX.XXX port 443...
[14-Aug-2014 21:28:10 UTC] Connected to webapi.teamviewer.com
[14-Aug-2014 21:28:10 UTC] C PUT /api/v1/reports/connections/d96631af-XXXX-4d13-8f9c-bdcad1c4bdee HTTP/1.1
[14-Aug-2014 21:28:10 UTC] C Host: webapi.teamviewer.com
[14-Aug-2014 21:28:10 UTC] C User-Agent: PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.109 $)
[14-Aug-2014 21:28:10 UTC] C Content-Type: application/json
[14-Aug-2014 21:28:10 UTC] C Accept: */*
[14-Aug-2014 21:28:10 UTC] C Authorization: Bearer XXXXXX-XXXXMgaDQ2mDNn17NyW
[14-Aug-2014 21:28:10 UTC] C Connection: Keep-Alive
[14-Aug-2014 21:28:10 UTC] C Content-Length: 26
[14-Aug-2014 21:28:10 UTC] C
[14-Aug-2014 21:28:10 UTC] C {"billing_state":"Billed"}
[14-Aug-2014 21:28:11 UTC] S HTTP/1.1 204 No Content
[14-Aug-2014 21:28:11 UTC] S Cache-Control: no-cache
[14-Aug-2014 21:28:11 UTC] S Pragma: no-cache
[14-Aug-2014 21:28:11 UTC] S Expires: -1
[14-Aug-2014 21:28:11 UTC] S Access-Control-Allow-Methods: POST, GET, DELETE, PUT
[14-Aug-2014 21:28:11 UTC] S Access-Control-Allow-Origin: *
[14-Aug-2014 21:28:11 UTC] S Access-Control-Allow-Headers: content-type,origin,Authorization
[14-Aug-2014 21:28:11 UTC] S Date: Thu, 14 Aug 2014 21:28:10 GMT
[14-Aug-2014 21:28:11 UTC] S

  4. Re: PUT does not stop to load   Reply   Report abuse  
Picture of Mathias Mathias - 2014-08-14 21:47:08 - In reply to message 3 from Mathias
[14-Aug-2014 21:41:21 UTC] Disconnected from webapi.teamviewer.com
[14-Aug-2014 21:41:21 UTC] OAuth client: Error: it was not possible to access the API call: could not get the request reply body: it was not possible to read data from the HTTP server: the server disconnected

  5. Re: PUT does not stop to load   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-08-14 23:20:37 - In reply to message 3 from Mathias
It seems the problem is that the server is not setting the content-length header. I think that is illegal, but since the response is 204, no content is expected, so I added a workaround to the HTTP class to make it assume content-length 0 in that case.

I have updated the HTTP class now. Please try it with the new version to see if you still have that problem.

  6. Re: PUT does not stop to load   Reply   Report abuse  
Picture of Mathias Mathias - 2014-08-15 08:26:11 - In reply to message 5 from Manuel Lemos
Hi,

it works perfectly.

Thanks a lot for the fast help.

  7. Re: PUT does not stop to load   Reply   Report abuse  
Picture of Senthilkumar Santhalingam Senthilkumar Santhalingam - 2014-08-28 03:59:35 - In reply to message 5 from Manuel Lemos
I am facing same problem with linkedin PUT.
I am getting the error it was not possible to access the API call: it was returned an unexpected response status 400 Response.
Which says Content length required.

Can you please help me to overcome this issue?

  8. Re: PUT does not stop to load   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-08-28 04:37:17 - In reply to message 7 from Senthilkumar Santhalingam
Did you upgrade to the latest version?

  9. Re: PUT does not stop to load   Reply   Report abuse  
Picture of Senthilkumar Santhalingam Senthilkumar Santhalingam - 2014-08-28 09:53:59 - In reply to message 8 from Manuel Lemos
Yes. I downloaded today.

  10. Re: PUT does not stop to load   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-08-28 10:15:37 - In reply to message 9 from Senthilkumar Santhalingam
What is the URL of the API call you are sending?

 
  1 - 10   11 - 15