0

This is my first time posting here, so forgive me if I leave out something important. Anyway, I'm trying to connect to Etsy's API using PHP and OAuth. I've been following the guide here: https://www.etsy.com/developers/documentation/getting_started/oauth#section_obtaining_temporary_credentials

I already created an account and app on Etsy, so I have my consumer key and secret. I've copied their code for getting a request token 100% and defined the two variables using my unique key and secret. However, when I try to make the http request, I get an "ERR_EMPTY_RESPONSE". When I click to get more detail it says: "Unable to load the webpage because the server sent no data". Here is a screenshot of the error page: https://i.stack.imgur.com/AxGN6.jpg

I'm using MAMP to make a localhost on port 8888 in order to test any PHP code that I write (e.g. to get to this php file I enter this url: localhost:8888/Etsy/EtsyOAuth.php).

My code is below. I edited out my key and secret.

            define('OAUTH_CONSUMER_KEY', "****");
            define('OAUTH_CONSUMER_SECRET', "****");

            // instantiate the OAuth object
            // OAUTH_CONSUMER_KEY and OAUTH_CONSUMER_SECRET are constants holding your key and secret
            // and are always used when instantiating the OAuth object
            $oauth = new OAuth(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET);

            // make an API request for your temporary credentials
            $req_token = $oauth->getRequestToken("https://openapi.etsy.com/v2/oauth/request_token?scope=email_r%20listings_r", 'oob');

            print $req_token['login_url']."\n";

I'm using pHP 5.6.7 and OAuth 1.2.3 says phpinfo().

Any help is much appreciated. Thanks in advance!

  • Welcome to the site Nick! I'm not familiar with the etsy API, but for Amazon I got a similar error until I told cURL not to verify the SSL. Hopefully someone more familiar with oAuth can point you in the right direction. – Josiah Jul 24 '15 at 19:44
  • I can't contribute to helping fix this, but please don't suggest that people turn off SSL verify for any sort of OAuth API (or any API really). It's incredibly dangerous and just not a good thing to do. 9 times out of 10, if that's what "fixed" your problem, then your problem was really somewhere else on the network stack and you just masked it (maybe a bad SSL setup). – hjc1710 Jul 24 '15 at 21:35

0 Answers0