Zend framework 3 and rackspace authenticate() is not working - php

This code was working fine with zf2 but when i migrated to ZF3 it is giving me the following error
$user = 'username';
$key = 'secret key';
$rackspace = new ZendService\Rackspace\Files($user,$key);
if ($rackspace->authenticate()) {
printf("Authenticated with token: %s",$rackspace->getToken());
} else {
printf("ERROR: %s",$rackspace->getErrorMsg());
}
File : zendframework\zendservice-rackspace\library\ZendService\Rackspace\AbstractRackspace.php:365
Message: Call to a member function getFieldValue() on boolean
The error is from the Rackspace library, I haven't use getFieldValue() anywhere

IN the Library itself there is a line that was causing the error
The line 401 in AbstractRackspace.php
$this->managementUrl = $result->getHeaders()->get(self::MANAGEMENT_URL)->getFieldValue();
the error was due to this line as the MANAGEMENT_URL is not set there in the header. i commented that line in the file and the error is gone

Related

issues running php as it unable to find the file

I am using the following to run the php file under xampp htdocs with foldername as kraken but i am getting an error
<?php
require_once 'KrakenAPIClient.php';
$key = 'dfdfdfdf';
$secret = 'dfdfdfdf';
// set which platform to use (currently only beta is operational, live available soon)
$beta = false;
$url = $beta ? 'https://api.beta.kraken.com' : 'https://api.kraken.com';
$sslverify = $beta ? false : true;
$version = 0;
$kraken = new KrakenAPI($key, $secret, $url, $version, $sslverify);
error i am getting is:
Fatal error: Uncaught Error: Class 'KrakenAPI' not found in C:\xampp\htdocs\kraken\example.php:21 Stack trace: #0 {main} thrown in C:\xampp\htdocs\kraken\example.php on line 21
You'd need to alias the class with use, before being able to skip it's name-space:
use \Payward\KrakenAPI;
Also see the PHP manual which I've linked for a more detailed explanation.

In Zend framework getting 500: Internal Server Error

I have one issue in zend framework got stuck due to this error
I developed Rest API but POST urls not working
500: Internal Server Error
but all get urls are working
When i debug all code its showing me error in AbstractTableGateway.php at line no 290 in executeInsert function
$result = $statement->execute();
full function code
protected function executeInsert(Insert $insert)
{
$insertState = $insert->getRawState();
if ($insertState['table'] != $this->table) {
throw new Exception\RuntimeException('The table name of the provided Insert object must match that of the table');
}
// apply preInsert features
$this->featureSet->apply('preInsert', array($insert));
$statement = $this->sql->prepareStatementForSqlObject($insert);
$result = $statement->execute();
$this->lastInsertValue = $this->adapter->getDriver()->getConnection()->getLastGeneratedValue();
// apply postInsert features
$this->featureSet->apply('postInsert', array($statement, $result));
return $result->getAffectedRows();
}
After this line code not working means its showing above error

I got Error on submitting query after complete install of Messagebundle in my project

I got yhis type of error :
ContextErrorException: Warning: Invalid argument supplied for foreach() in /var/www/html/imsdemo/vendor/friendsofsymfony/message-bundle/FOS/MessageBundle/Entity/Thread.php line 81
please help me to solve this Error...
protected function getParticipantsCollection()
{
if ($this->participants == null) {
$this->participants = new ArrayCollection();
/* Line 81*/ foreach ($this->metadata as $data) {
$this->participants->add($data->getParticipant());
}
}
return $this->participants;
}
this the code which give error
I got the Issue why is happening because of whenever I do schema update of database its taking the MyBundle/Resources/config/doctrine YML file which not update my database as FosMessageBundle has...so when i had remove the /config/doctrine folder and then do the schema update It is working fine ...

whatsapp api request code not executing and not returning a request code

I am trying to implement the whatsAPI but I always get this error
"There was a problem trying to request the code".
Here is the full error that is showing in my console:
####start of error notice#####
[12-Mar-2013 22:44:59] PHP Notice: Undefined property: stdClass::$reason in /Applications/MAMP/htdocs/whatsapp/test/whatsprot.class.php on line 1268
[12-Mar-2013 22:44:59] PHP Fatal error: Uncaught exception 'Exception' with message 'There was a problem trying to request the code.' in /Applications/MAMP/htdocs/whatsapp/test/whatsprot.class.php:1269
Stack trace:
#0 /Applications/MAMP/htdocs/whatsapp/test/test.php(36): WhatsProt->checkCredentials()
#1 {main}
thrown in /Applications/MAMP/htdocs/whatsapp/test/whatsprot.class.php on line 1269
####end of error notice#####
these are my credentials for initializing the class
$userPhone = '8801770648732';
$userIdentity = '352264050503669';
$userName = 'shishir';
$destinationPhone = '8801713206053';
$debug = TRUE;
$whatsapp = new WhatsProt($userPhone, $userIdentity, $userName, $debug);
and for the requesting a requestCode
$service_type = "sms";
$country_code = "BD";
$language_code = "en";
$request_code = $whatsapp->requestCode($service_type, $country_code, $language_code);
Every time it stuck at the $whatsapp->requestCode with that error. I'm not sure what i am doing wrong . Can anyone help me on this?
It's look like you don't have curl extension.
This Exception is thrown by checkCredentials method.
Check if your phpinfo shows curl.

Consistent error accessing Soundcloud API with PHP on bluehost server

I'm having trouble with Soundcloud.php on my server. Although it runs just fine on my MAMP installation. Basically my test page won't load and an error is logged declaring a problem in Soundcloud.php:
[03-Apr-2012 03:50:57] PHP Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /home2/mysite/public_html/mysubdomain/Soundcloud.php on line 685
the test code is fine - here it is for reference:
<?php
require 'Soundcloud.php';
$soundcloud = new Services_Soundcloud('Client_ID','Client_Secret', 'Redirect_URI');
try {
$info = json_decode($soundcloud->get('tracks', array('user_id' => 'blumarten')), true);
print_r($info);
}
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
exit($e->getMessage());
}
I just had the account upgraded to PHP 5.3 but the error still occurs, any ideas?
SoundCloud PHP API and documentation are very poor and buggy at the moment , hopefully will get better.
Replace this code around line 720
$postData = array_map(function ($track) {
return 'playlist[tracks][][id]=' . $track;
}, $trackIds);
With this:
$postData = array_map("suckySc", $trackIds);
And add this function to the top of the file, before the class opening:
function suckySc ($track){
return 'playlist[tracks][][id]=' . $track;
}

Categories