2014-11-10 2 views
2

REST 메서드를 사용하여 집을 부재중 모드로 설정하려고합니다. 나는 그것을 cURL로 시도하고 있지만, "리디렉션 후 연결이 거부되었습니다"라는 메시지가 계속 나타납니다.Nest Rest API 연결이 거부 됨

내 코드 :

$ch = curl_init("https://developer-api.nest.com/structures/$id?auth=$access_token"); 
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); 
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"away":"away"}'); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_VERBOSE, 1); 
curl_setopt($ch, CURLOPT_STDERR, $fp); 
curl_setopt($ch, CURLOPT_PUT, true); 

echo curl_exec($ch); 

오류 로그 (내 ID 및 액세스 코드 변경) : 초기 연결이 작동하는 이유

* About to connect() to developer-api.nest.com port 443 (#0) 
* Trying 54.235.247.171... * connected 
* Connected to developer-api.nest.com (54.235.247.171) port 443 (#0) 
* Initializing NSS with certpath: sql:/etc/pki/nssdb 
* CAfile: /etc/pki/tls/certs/ca-bundle.crt 
    CApath: none 
* SSL connection using TLS_DHE_RSA_WITH_AES_128_CBC_SHA 
* Server certificate: 
* subject: CN=developer-api.nest.com,OU=Domain Control Validated 
* start date: Apr 10 21:26:03 2014 GMT 
* expire date: Apr 10 21:26:03 2015 GMT 
* common name: developer-api.nest.com 
* issuer: CN=Go Daddy Secure Certificate Authority - G2,OU=http://certs.godaddy.com/repository/,O="GoDaddy.com, Inc.",L=Scottsdale,ST=Arizona,C=US 
> PUT /structures/asdfghjkl?auth=c.asdfghjkl HTTP/1.1 
Host: developer-api.nest.com 
Accept: */* 
Transfer-Encoding: chunked 
Expect: 100-continue 

< HTTP/1.1 100 Continue 
< HTTP/1.1 307 Temporary Redirect 
< Content-Type: application/json; charset=UTF-8 
< Access-Control-Allow-Origin: * 
< Cache-Control: private, no-cache, max-age=0 
< Location: https://firebase-apiserver03-tah01-iad01.dapi.production.nest.com:9553/structures/asdfghjkl?auth=c.asdfghjkl 
< Connection: close 
< Content-Length: 0 
< 
* Closing connection #0 
* Issue another request to this URL: 'https://firebase-apiserver03-tah01-iad01.dapi.production.nest.com:9553/structures/asdfghjkl?auth=c.asdfghjkl' 
* About to connect() to firebase-apiserver03-tah01-iad01.dapi.production.nest.com port 9553 (#0) 
* Trying 54.167.139.72... * Connection refused 
* couldn't connect to host 
* Closing connection #0 

어떤 생각하지만, 리디렉션하지?

답변

3

내 웹 서버에 문제가 있음을 발견하여 포트 9553이 아웃 바운드 쪽에서 차단되어 있으므로 firebase이 내 연결을 거부하지 않았으며, 내 방화벽 전체 시간이었습니다. 포트 9553을 열면 모든 것이 정상적으로 작동합니다.