Dropbox API and PHP - php

I am gelling following error while trying to read file content which is residing in a subfolder rather than a parent folder.
Fatal error: Uncaught exception 'Exception' with message 'Invalid
signature. Expected signature base string:
GET&https%3A%2F%2Fapi-content.dropbox.com%2F1%2Ffiles%2Fdropbox%2FProjects%2FMAC%2520Error.rtf&oauth_consumer_key%3Dbdagb07uu6zq827%26oauth_nonce%3D46d063d5815a0972d63cf72359c0349f%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1324449973%26oauth_token%3D7f2cr9kppqo2hxz%26oauth_version%3D1.0
(Status Code: 403)' in
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/Dropbox/OAuth/Consumer/Curl.php:133
Stack trace: #0
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/Dropbox/API.php(109):
Dropbox\OAuth\Consumer\Curl->fetch('GET', 'https://api-con...',
'files/dropbox/P...', Array) #1
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/check.php(21):
Dropbox\API->getFile('Projects/MAC Er...') #2 {main} thrown in
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/Dropbox/OAuth/Consumer/Curl.php
on line 133
I am using Ben's Dropbox Library for php
https://github.com/BenTheDesigner/Dropbox
Thanks

If you are looking for a simple PHP-API you can find one here:
https://github.com/hawaiianchimp/Dropbox-PHP-API/

This is the message thats returned when a OAuth request is signed incorrectly. This is likely the fault of the library you're using. At first glance, it looks like it may be encoding the name of your "MAC Error.rtf" file incorrectly. Checkout the PHP SDK dropbox mentions on its website as an alternative and raise this issue with the library's owner.
The code that generates this would help too.

Related

Fatal error: Uncaught DocuSign\eSign\Client\ApiException: Error while requesting server, received a non successful HTTP code [302]

I created a demo app using the DocuSign Quickstart tool, but I get this error the moment my app attempts to use the "createEnvelope" function:
$results = $envelopeApi->createEnvelope($GLOBALS['DS_CONFIG']['ds_client_id'], $envelope_definition);
I'm sure it has to do with the Integration Key, but I don't know docusugn well enough to resolve the issue.
Any direction would be much appreciated.
Here's the full error:
Fatal error: Uncaught DocuSign\eSign\Client\ApiException: Error while requesting server, received a non successful HTTP code [302] with response Body: in C:\xampp\htdocs\embedded\vendor\docusign\esign-client\src\Client\ApiClient.php:344 Stack trace:
#0 C:\xampp\htdocs\embedded\vendor\docusign\esign-client\src\Api\EnvelopesApi.php(4117): DocuSign\eSign\Client\ApiClient->callApi('/v2.1/accounts/...', 'POST', Array, '{"documents":[{...', Array, '\\DocuSign\\eSign...', '/v2.1/accounts/...')
#1 C:\xampp\htdocs\embedded\vendor\docusign\esign-client\src\Api\EnvelopesApi.php(4023): DocuSign\eSign\Api\EnvelopesApi->createEnvelopeWithHttpInfo('xxxxxxxx-xxxx-x...', Object(DocuSign\eSign\Model\EnvelopeDefinition), NULL)
#2 C:\xampp\htdocs\embedded\public\index.php(117): DocuSign\eSign\Api\EnvelopesApi->createEnvelope('xxxxxxxx-xxxx-x...', Object(DocuSign\eSign\Model\EnvelopeDefinition))
#3 C:\xampp\htdocs\embedded\public\index.php(169): Example\make_envelope(Array) #4 {main} thrown in C:\xampp\htdocs\embedded\vendor\docusign\esign-client\src\Client\ApiClient.php on line 344
From the error trace, specifically the path "C:\xampp\htdocs\embedded\vendor\docusign\esign-client\src\Client\ApiClient.php", it looks like you deleted the outer folder.
I'm curious to know what you put in your C:\xampp\apache\conf\httpd.conf file. This setting in the httpd.conf file needs to match if you've deleted that folder:
DocumentRoot "C:/xampp/htdocs/Tally_Customer_Portal-php"
I would go through the quickstart guide on DocuSign. That way it will build out the code you need to get started. I would also make sure your token information is correct as well.
I lifted this code from a few different sources, and unfortunately it came with a few different problems. The one in this particular case was from the 'ds_client_id' value, which the QuickStart guide automatically assigns with your Integration Key. When running the createEnvelope function, you need your Account ID, not the Integration Key.

Google\Cloud\Storage\StorageObject->downloadAsString() uncaught error

I have a PHP script that reads files from Cloud Storage. It works fine in local dev. But when it's run in App Engine standard environment, it outputs this error message:
Fatal error: Uncaught Google\Cloud\Core\Exception\ServiceException in /srv/vendor/google/cloud/Core/src/RequestWrapper.php:362
Stack trace:
#0 /srv/vendor/google/cloud/Core/src/RequestWrapper.php(206): Google\Cloud\Core\RequestWrapper->convertToGoogleException(Object(GuzzleHttp\Exception\RequestException))
#1 /srv/vendor/google/cloud/Storage/src/Connection/Rest.php(224): Google\Cloud\Core\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request), Array)
#2 /srv/vendor/google/cloud/Storage/src/StorageObject.php(643): Google\Cloud\Storage\Connection\Rest->downloadObject(Array)
#3 /srv/vendor/google/cloud/Storage/src/StorageObject.php(574): Google\Cloud\Storage\StorageObject->downloadAsStream(Array)
#4 /srv/modules/profile/controllers/getresource.class.php(69): Google\Cloud\Storage\StorageObject->downloadAsString()
This doesn't happen to most of the files. The file causing this issue is about 250KB. I am wondering is there some kind of size limitation with downloadAsString()?
One of the files causing this issue is https://www.justjeans.com.au/wcsstore/JustJeansAuroraStorefrontAssetStore/css/main.css?timestamp=2019070295000
The downloadAsString() method downloads the file using stream, and then casts it to a string before returning it.
Link to the SDK code
There should not be any issues with file sizes unless you are running out of memory in your PHP process.
Is there a file that causes the issue every time? If so, maybe adding that to the question would be a good idea.

Could not find a valid ServiceManager for RoutePluginManager

When I try to run zend program its shows error as follows
PHP Fatal error: Uncaught exception
'Zend\ModuleManager\Listener\Exception\RuntimeException' with message
'Could not find a valid ServiceManager for RoutePluginManager' in
/Documents/zf2-example-login/vendor/zendframework/zend-modulemanager/src/Listener/ServiceListener.php:202
Stack trace:
#0 /Documents/zf2-example-login/vendor/zendframework/zend-eventmanager/src/EventManager.php(271):
Zend\ModuleManager\Listener\ServiceListener-onLoadModulesPost(Object(Zend\ModuleManager\ModuleEvent))
#1 /Documents/zf2-example-login/vendor/zendframework/zend-eventmanager/src/EventManager.php(143):
Zend\EventManager\EventManager-triggerListeners(Object(Zend\ModuleManager\ModuleEvent))
#2 /Documents/zf2-example-login/vendor/zendframework/zend-modulemanager/src/ModuleManager.php(129):
Zend\EventManager\EventManager-triggerEvent(Object(Zend\ModuleManager\ModuleEvent))
#3 /Documents/zf2-example-login/vendor/zendframework/zend-mvc/src/Application.php(264): Zend\ModuleManager\ModuleManager-> in
/Documents/zf2-example-login/vendor/zendframework/zend-modulemanager/src/Listener/ServiceListener.php
on line 202
I'm newbie to zend, I tried googling but unable to find the solution.Help me.
Found a clue here:
https://github.com/zendframework/zend-modulemanager/issues/42
You first need to check to see if you have ZF3 installed. One quick way to check is to look under "vendor/zendframework" and see if you have a subdirectory "zend-router".
If so, add this to your application.config.php file under the "modules" key:
'Zend\Router'

Getting 500 Internal Server Error with Stripe

I am trying to implement basic functionality of the Stripe API, I get 500 Internal Server Error for some reason when I require the Stripe.php file that you have to require...When I comment the require out the error goes away but obviously I can not use the API then..
Basic require...shows error in the Modal Log
require_once('/php/Stripe.php');
I checked the server error and it gave me this back
Fatal error: Uncaught exception 'Exception' with message 'Stripe needs the Multibyte String PHP extension.' in /php/Stripe.php:13 Stack trace: #0 /home/stripepost.php(4): require_once() #1 {main} thrown in /php/Stripe.php on line 13
This all comes from just requiring the file..
Is your 'Stripe.php' file really located in '/php' or is it in a folder called 'php' local to your code?
Current code:
require_once('/php/Stripe.php');
I think the problem is this. You probably mean to use something relative to your code base. Like this:
require_once('./php/Stripe.php');
I found out the answer I didn't have the mbstring enabled on my server...whooops

fatal error in googleapi

i have to use google api in my project using php
the project : using google search engine and gathering urls and their source pages
i downloaded google api php client and i followed what ever is written here
https://code.google.com/p/google-api-php-client/
after running i ge this error:
Fatal error: Uncaught exception 'Google_ServiceException' with message 'Error calling GET https://www.googleapis.com/plus/v1/people/me/activities/public?key=[REDACTED]: (403) Access Not Configured' in C:\xampp\htdocs\google-api-php-client\src\io\Google_REST.php:66 Stack trace: #0 C:\xampp\htdocs\google-api-php-client\src\io\Google_REST.php(36): Google_REST::decodeHttpResponse(Object(Google_HttpRequest)) #1 C:\xampp\htdocs\google-api-php-client\src\service\Google_ServiceResource.php(186): Google_REST::execute(Object(Google_HttpRequest)) #2 C:\xampp\htdocs\google-api-php-client\src\contrib\Google_PlusService.php(58): Google_ServiceResource->__call('list', Array) #3 C:\xampp\htdocs\googleapitest.php(31): Google_ActivitiesServiceResource->listActivities('me', 'public') #4 {main} thrown in C:\xampp\htdocs\google-api-php-client\src\io\Google_REST.php on line 66
i am completely confused and don't know what to do
That error often means you're not matching your access requirements in the API console - i.e. if you have IP or referrer restrictions configured.
Just remove your developer key and add the scope
'www.googleapis.com/auth/userinfo.email',
'www.googleapis.com/auth/userinfo.profile',
'www.googleapis.com/auth/plus.login',
'www.googleapis.com/auth/plus.me'));

Categories