dirkgroenen / pinterest-api-php

A PHP wrapper for the official Pinterest API. :pushpin:
https://developers.pinterest.com/docs/getting-started/introduction/
Apache License 2.0
173 stars 76 forks source link

boards->create function issues #31

Closed Cteha closed 8 years ago

Cteha commented 8 years ago

The following:

$board = $pinterest->boards->create(array(
    "name"          => "Bla Bla"
));

returns an object like this and no board get created: {"id":null,"name":null,"url":null,"description":null,"creator":null,"created_at":null,"counts":null,"image":null}

SerzhYevtushenko commented 8 years ago

I think that problem is in class: src/Pinterest/Utils/CurlBuilder.php, method: execFollow line: 205 $response = curl_exec($rch); First request in loop returns:

HTTP/1.1 100 Continue

HTTP/1.1 301 Moved Permanently Accept-Ranges: bytes Cache-Control: private Content-Type: text/html; charset=utf-8 Location: https://api.pinterest.com/v1/boards/ Server: nginx X-Pinterest-RID: 682442903996 X-Varnish: 4209913906 Content-Length: 279 Date: Mon, 01 Feb 2016 17:47:16 GMT Connection: keep-alive

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

Redirecting...

Redirecting...

You should be redirected automatically to target URL: https://api.pinterest.com/v1/boards/. If not click the link.

The second one returns:

HTTP/1.1 100 Continue

HTTP/1.1 401 Unauthorized Accept-Ranges: bytes Cache-Control: private Content-Type: application/json Pinterest-Generated-By: devplatform-devapi-prod-be24d169 Pinterest-Version: f2fe346 Server: nginx X-Content-Type-Options: nosniff X-Pinterest-RID: 140850051584 X-Varnish: 2750063476 Content-Length: 177 Date: Mon, 01 Feb 2016 17:48:11 GMT Connection: close

{"status": "failure", "code": 3, "host": "devplatform-devapi-prod-be24d169", "generated_at": "Mon, 01 Feb 2016 17:48:11 +0000", "message": "Authorization failed.", "data": null}

The same issue with create pin.

dirkgroenen commented 8 years ago

Sounds like the auth header isn't parsed to the second request, I'll check it out.

attx commented 8 years ago

The same issue with delete board, get remaining calls etc.

dirkgroenen commented 8 years ago

Looking into it right now. The execFollow function has been a copy-paste duo the lack of time, I'm polishing it at the moment.

dirkgroenen commented 8 years ago

Fixed in 0.2.8

SerzhYevtushenko commented 8 years ago

Unfortunately issue is still actual for me

dirkgroenen commented 8 years ago

Nothing changed in the response or something else?

dirkgroenen commented 8 years ago

I've just tested it again and everything seems to work fine for me. You can find the code I'm using to test with in the ./demo directory.

SerzhYevtushenko commented 8 years ago

Problem was on the local machine. On dev server everything fine. Thanks for fix.

dirkgroenen commented 8 years ago

:+1:

aliakbarazizi commented 4 years ago

Still has this problem in last verison

waqasasif9292 commented 4 years ago

I am facing the same problem. Please help!