You must be a registered Vyew member to post in the forum. Login or Register for free
If you just logged in, you may need to refresh this page.
   
 
Getting error 0 when creating
Posted: 30 September 2009 03:27 PM   Ignore ]  
New User
Rank
Total Posts:  5
Joined  2009-09-24

Hi,
i’m getting an error while creating a room
this is the error i read from my code (firebug)

file_get_contents(https://vyew.com/api/api.php?cmd=create&name=&type=vyew&owner=&key=cab449b34a&time=1254352590&md5=9248e6e37c19c6e339fb9fc99ded1fb4) [function.file-get-contents]: failed to open stream: No error in D:\xampp\htdocs\proy_adminV.beta1\php\VyewAPI.php on line 981

Failed to create meeting

As you can see i get the error on line 981 (same error as i saw on a different post but was unanswered). This is the code i use

$api_key="cab449b34a";
    
$api_secret="****************";
        require_once(
'VyewAPI.php');
        
$vyew = new VyewAPI($api_key$api_secret);
        
//Create a new meeting room
        
$res=$vyew->create();
        if(
$res[0]!=1) die("Failed to create meeting");
        
$vyewBookID=$res[2];
        
$roomURL=$res[3];

of course the ************ is the api secret provided by vyew. $res[0] returns 0… no idea what that means....
i used the address generated and used in line 981 (https://vyew.com/api/api.php?cmd=create&name=&type=vyew&owner=&key=cab449b34a&time=1254352590&md5=9248e6e37c19c6e339fb9fc99ded1fb4) on my browser and it shows a simple html with the text:
0|Error: Missing API key.

Can anybody help please,
Reguards,
Malcolm

Profile
 
Posted: 01 October 2009 08:31 AM   Ignore ]   [ # 1 ]  
Administrator
RankRankRank
Total Posts:  97
Joined 

Hi,

Can you please run a very simple test for me? Make a PHP file with the following:

<?php
$test = file_get_contents("http://google.com/");
print("Got ".strlen($test)." bytes. ");
$test = file_get_contents("https://vyew.com/go/login");
print("Got ".strlen($test)." bytes. ");
?>

Upload it to your server, then load it in your browser. If it is working, you should get an output like this: (numbers may be different)

Got 7016 bytes. Got 11900 bytes.

Please let me know if you get the above output, something else, and if you get any PHP errors.

Profile
 
Posted: 01 October 2009 09:18 AM   Ignore ]   [ # 2 ]  
New User
Rank
Total Posts:  5
Joined  2009-09-24

hi David… thx for the response
i tested the code on my ph and got a failed to open stream message…

i’m getting this response from the php:

Got 7291 bytes.

Warning:  file_get_contents(https://vyew.com/go/login) [function.file-get-contents]: failed to open stream: Invalid argument in D:\xampp\htdocs\proy_adminV.beta1\php\controller.php on line 197

Got 0 bytes.

reguards,
Malcolm

Profile
 
Posted: 01 October 2009 09:31 AM   Ignore ]   [ # 3 ]  
Administrator
RankRankRank
Total Posts:  97
Joined 

Ok, for some reason your PHP setup is not allowing the use of the file_get_contents() command on HTTPS urls. The Vyew API must be accessed via HTTPS for security reasons, and we wrote the VyewAPI.php helper class using the file_get_contents() PHP command.

I am not sure why it’s not working for you, perhaps something is missing in your PHP setup, or maybe it was disabled for some reason?

The options I can think of are:
A) Ask the admin/owner of your server for help with using file_get_contents() on a https URL
B) Switch to a different server where it does work
C) Write your own PHP code which uses something else, perhaps CURL, instead of using our VyewAPI.php class. You can look at the VyewAPI.php code or the documentation on our website to learn how the API works internally.

Profile
 
Posted: 01 October 2009 09:46 AM   Ignore ]   [ # 4 ]  
New User
Rank
Total Posts:  5
Joined  2009-09-24

changed servers and the warning is gone.... still get 0 bytes from vyew

Got 219 bytes. Got 0 bytes.

thx for the sugestions… i try to get it to work.... if i get it...ill post my code here

Profile
 
Posted: 06 October 2009 09:45 AM   Ignore ]   [ # 5 ]  
New User
Rank
Total Posts:  5
Joined  2009-09-24

I had security problems getting https requests so i had to find a way arround it using cURL… this is probably not the best way to go about fixing it but it works.

private function callAPI$cmd$argsArray=array(), $explode_count=NULL )
    
{
        
if($this->debug$this->trace("callAPI:$cmd");
        if(
$this->debug$this->trace($argsArray);

        
$epoch_time=time();

        
//--- assemble argument array into string
        
$query "cmd=$cmd";
        foreach (
$argsArray as $argName=>$argValue{
            
if(is_array($argValue)){
                
foreach ($argValue as $argName2=>$argValue2{
                    $query 
.= "&" $argName2 "=" urlencode($argValue2);
                
}                
            }else{
               $query 
.= "&" $argName "=" urlencode($argValue);
            
}
        }
        $query 
.= "&key;=" $this->apikey "&time;=$epoch_time";

        
//--- make md5 hash of the query + secret string
        
$md5 md5($query $this->secret);
        
$url $this->apiurl."?$query&md5;=$md5";

        
//--- simple GET request, put its contents into $response
    
$log = new Log('report.log');
// Initialize the CURL library
$cURL curl_init();

// Set the URL to execute
curl_setopt($cURLCURLOPT_URL$url);
$log->message("CURL URL: " $url);
// Set options
curl_setopt($cURLCURLOPT_HEADER1);
curl_setopt($cURLCURLOPT_RETURNTRANSFER1);

// Execute, saving results in a variable
$strPage curl_exec($cURL);

// Close CURL resource
curl_close($cURL);

$log->message("CURL $strPage: " $strPage);
$responseposition=strpos($strPage,'Content-Type')+23 ;
    
$log->message("CURL responseposition: " $responseposition);
$response=substr($strPage,$responseposition);
        
$log->message("CURL response: " $response);
        
        if(
$this->debug$this->trace("callAPI RESPONSE:$cmd");
        if(
$this->debug$this->trace($response);

        
//--- convert "|" (pipe) delimited string to array
        
$responseArray $this->processVyewResult($response$explode_count);

        if(
$this->debug$this->trace($responseArray);
        return 
$responseArray;
    
}

make sure cURL is correcly configured for PHP

Profile
 
Posted: 19 November 2009 05:29 AM   Ignore ]   [ # 6 ]  
New User
Rank
Total Posts:  1
Joined  2009-11-18

The codes worked for me just right now. Thanks for the help. I was really having the same problems awhile ago.

Regards,
Debbie
Ordinateur portable pas cher

Profile
 
Posted: 26 April 2011 02:40 AM   Ignore ]   [ # 7 ]  
New User
Rank
Total Posts:  2
Joined  2011-04-22

I am having the same problem!!!

I replaced the callAPI() method with above mention method but to no avail....do i have to make any other changes in the script

Profile
 
Posted: 08 November 2011 12:59 AM   Ignore ]   [ # 8 ]  
New User
Rank
Total Posts:  2
Joined  2011-07-19

HI David,
I have tried the options below but am still getting the same error, I’m also attaching the full code with this message.
VyewAPI Object
(
[debuglog] =>
[useFakeData] =>
[apikey] => ff005e0c5b
[secret] => fade86ce62e968c76b22
[apiurl] => https://vyew.com/api/v2.1/api.php
)
Array
(
[0] => 0
[1] => Error: Missing API key.
Please help immediately.
Thanks

David R (Vyew.com) - 01 October 2009 09:31 AM

Ok, for some reason your PHP setup is not allowing the use of the file_get_contents() command on HTTPS urls. The Vyew API must be accessed via HTTPS for security reasons, and we wrote the VyewAPI.php helper class using the file_get_contents() PHP command.

I am not sure why it’s not working for you, perhaps something is missing in your PHP setup, or maybe it was disabled for some reason?

The options I can think of are:
A) Ask the admin/owner of your server for help with using file_get_contents() on a https URL
B) Switch to a different server where it does work
C) Write your own PHP code which uses something else, perhaps CURL, instead of using our VyewAPI.php class. You can look at the VyewAPI.php code or the documentation on our website to learn how the API works internally.

File Attachments 
test.zip  (File Size: 14KB - Downloads: 0)
Profile