Failed to create session: Invalid response from server

Ask general questions or talk about OpenTok here! Questions about a specific OpenTok API Platform should be asked in its respective forum.

Failed to create session: Invalid response from server

Postby shivakumar » Mon Sep 17, 2012 12:54 am

Can anyone help me out in fixing the below issue which i am facing when trying to log into my site. The page contains a video uploaded using Opentok

OpenTokException

Failed to create session: Invalid response from server
Was this post helpful? (0)
shivakumar
 
Posts: 2
Joined: Mon Sep 17, 2012 12:48 am
Thumbs Up: 0

Re: Failed to create session: Invalid response from server

Postby jtsai » Mon Sep 17, 2012 11:02 am

What is the session id and token you are using?

John
Was this post helpful? (0)
User avatar
jtsai
 
Posts: 4965
Joined: Wed Sep 14, 2011 3:00 pm
Thumbs Up: 192

Re: Failed to create session: Invalid response from server

Postby askapeer » Mon Sep 17, 2012 6:13 pm

Hello,

We are having the same problem. Everything was working fine till at least two days ago. No changes in the code from our side.

Currently we're having problems with this line of code:
$apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
$session = $apiObj->create_session($_SERVER["REMOTE_ADDR"]);

result is
exception 'OpenTokException' with message 'Failed to create session: Invalid response from server'

Stack trace:
opentok/OpenTokSDK.php(229): OpenTokSDK->createSession('our IP address', Array)
Was this post helpful? (0)
askapeer
 
Posts: 2
Joined: Mon Sep 17, 2012 6:07 pm
Thumbs Up: 0

Re: Failed to create session: Invalid response from server

Postby askapeer » Mon Sep 17, 2012 6:22 pm

We just solved by changing the OpenTokSDK.php with the latest version
Was this post helpful? (0)
askapeer
 
Posts: 2
Joined: Mon Sep 17, 2012 6:07 pm
Thumbs Up: 0

Re: Failed to create session: Invalid response from server

Postby denpap » Sun Nov 04, 2012 2:08 am

Hello all,

I had the same problem because I didn't have php5_curl installed. Please openTok fix "file_get_contents" in OpenTokSDK.php
Was this post helpful? (0)
denpap
 
Posts: 2
Joined: Wed Oct 31, 2012 9:35 am
Thumbs Up: 0

Re: Failed to create session: Invalid response from server

Postby janine » Mon Nov 05, 2012 4:25 pm

Thanks for the feedback!
Was this post helpful? (0)
janine
 
Posts: 1681
Joined: Thu May 05, 2011 7:10 pm
Thumbs Up: 20

Re: Failed to create session: Invalid response from server

Postby melih » Mon Nov 05, 2012 4:50 pm

Could you please clarify the role you think file_get_contents plays in all of this?

More specifically:

* Are you on PHP5?
* Are you unable to use cURL?
* Did your SDK not fallback to using file_get_contents?
* What do you think the right method to use is here?

Thanks.
Was this post helpful? (0)
melih
 
Posts: 33
Joined: Thu May 05, 2011 6:57 pm
Thumbs Up: 11

Re: Failed to create session: Invalid response from server

Postby denpap » Wed Nov 07, 2012 1:07 am

melih wrote:Could you please clarify the role you think file_get_contents plays in all of this?

More specifically:
* Are you on PHP5?

Yes 5.3.5-1ubuntu7.11 (the default on Ubuntu 11.04)
melih wrote: * Are you unable to use cURL?

Basically I didn't know I needed it and its not installed by default. When I installed it
it worked.
melih wrote: * Did your SDK not fallback to using file_get_contents?

It did. But that method is not working correctly
melih wrote: * What do you think the right method to use is here?

Not sure. Either throw a message somewhere to get php-curl is installed or
get "file_get_contents" to work correctly.

melih wrote:Thanks.


This is the offending code (OpenTokSDK.php- line 202) which is not returning anything.
Code: Select all
           if (function_exists("file_get_contents")) {
                $context_source = array ('http' => array (
                                        'method' => 'POST',
                                        'header'=> Array("Content-type: application/x-www-form-urlencoded", $authStri$
                                        )
                                    );
                $context = stream_context_create($context_source);
                $res = @file_get_contents( $url ,false, $context);
Was this post helpful? (0)
denpap
 
Posts: 2
Joined: Wed Oct 31, 2012 9:35 am
Thumbs Up: 0

Re: Failed to create session: Invalid response from server

Postby melih » Fri Nov 09, 2012 2:15 pm

Now that we understand where the bug is, we will fix it. Thanks for letting us know.

Thanks for your patience as well, and working with us.
Was this post helpful? (0)
melih
 
Posts: 33
Joined: Thu May 05, 2011 6:57 pm
Thumbs Up: 11


Return to Discussion and Questions



Who is online

Users browsing this forum: No registered users and 2 guests

cron