Dropbox
Dropbox copied to clipboard
How to deploy this into my own server? Error:'Couldn't resolve host 'api.dropbox.com''
I am using free hosting web on 2freehosting.com (php 5.3.24).
- I uploaded the
Dropbox
folder & its sub-directories under public_html. - I put examples/bootstap.php & tests/setup.php under /public_html/pushover/.
- Edited bootstrap.php:
$key = 'my-app-key';
$secret = 'my-app-secret';
$protocol = (!empty($_SERVER['HTTPS'])) ? 'https' : 'http';
$callback = $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$encrypter = new \Dropbox\OAuth\Storage\Encrypter('24810121416182022242628303234363');
$userID = 1;
$storage = new \Dropbox\OAuth\Storage\PDO($encrypter, $userID);
$storage->connect('mysql.2freehosting.com', 'u311345763_db', 'u211345763_db', 'my-database-pass', 3306);
I do not understand what should be userID
or how to find it. So I left it as it is.
Now when I am pinging setup.php
it gives me a error:
Fatal error: Uncaught exception 'Dropbox\Exception\CurlException' with message 'Couldn't resolve host 'api.dropbox.com'' in /home/u31134576/public_html/Dropbox/OAuth/Consumer/Curl.php:113 Stack trace: #0 /home/u31134576/public_html/Dropbox/OAuth/Consumer/ConsumerAbstract.php(68): Dropbox\OAuth\Consumer\Curl->fetch('POST', 'https://api.dro...', '') #1 /home/u31134576/public_html/Dropbox/OAuth/Consumer/ConsumerAbstract.php(52): Dropbox\OAuth\Consumer\ConsumerAbstract->getRequestToken() #2 /home/u31134576/public_html/Dropbox/OAuth/Consumer/Curl.php(61): Dropbox\OAuth\Consumer\ConsumerAbstract->authenticate() #3 /home/u31134576/public_html/pushover/bootstrap.php(48): Dropbox\OAuth\Consumer\Curl->__construct('my-app-key', 'my-app-secret', Object(Dropbox\OAuth\Storage\PDO), 'http://zetacode...') #4 /home/u31134576/public_html/pushover/setup.php(10): require_once('/home/u31134576...') #5 {main} thrown in /home/u211345713/public_html/Dropbox/OAuth/Consumer/Curl.php on line 113
Hi @khurshid-alam
The library provides 2 different ways of storing tokens, either session based (the token will need to be acquired for each session), or persistently based on user ID. The $userID
variable should be the ID of the logged in user in your system, but it can also be a fixed value (if you simply want everyone to use the same token and connect to a single Dropbox).
Please also read readme.md
in the exmaples directory for how to configure both storage mechanisms.
Thanks for clearing that up. I am using fixed value for $userID
. It has successfully created the database & there is no problem connecting to it.But the error I am getting is :
Fatal error: Uncaught exception 'Dropbox\Exception\CurlException' with message 'Couldn't resolve host 'api.dropbox.com'' in /home/u31134576/public_html/Dropbox/OAuth/Consumer/Curl.php:113 Stack trace: #0 /home/u31134576/public_html/Dropbox/OAuth/Consumer/ConsumerAbstract.php(68): Dropbox\OAuth\Consumer\Curl->fetch('POST', 'https://api.dro...', '') #1 /home/u31134576/public_html/Dropbox/OAuth/Consumer/ConsumerAbstract.php(52): Dropbox\OAuth\Consumer\ConsumerAbstract->getRequestToken() #2 /home/u31134576/public_html/Dropbox/OAuth/Consumer/Curl.php(61): Dropbox\OAuth\Consumer\ConsumerAbstract->authenticate() #3 /home/u31134576/public_html/pushover/bootstrap.php(48): Dropbox\OAuth\Consumer\Curl->__construct('my-app-key', 'my-app-secret', Object(Dropbox\OAuth\Storage\PDO), 'http://zetacode...') #4 /home/u31134576/public_html/pushover/setup.php(10): require_once('/home/u31134576...') #5 {main} thrown in /home/u211345713/public_html/Dropbox/OAuth/Consumer/Curl.php on line 113
It seems it couldn't resolve the host api.dropbox.com
when making POST request. What am I missing?
Hi,
This sounds like a network issue between your shared server and one of the Dropbox endpoints. I don't think it is related to the code in this library, so unfortunately I won't be able to assist.
Try getting in touch with your hosting provider to see if they can help you resolve the issue.