Comments (5)
Please provide more information :
- environment ? OS ? Version ?
- phpinfo
- how did you install the sdk ? with composer ?
from evernote-cloud-sdk-php.
env
PHP 5.5.23 (cli) (built: Mar 23 2015 01:47:37)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
intl
json
ldap
libxml
mbstring
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
[Zend Modules]
error:
PHP Fatal error: Uncaught exception 'Thrift\Exception\TTransportException' with message 'THttpClient: Could not read 4 bytes from sandbox.evernote.com:443/edam/user' in /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Transport/THttpClient.php:163
Stack trace:
#0 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Transport/TTransport.php(74): Thrift\Transport\THttpClient->read(4)
#1 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Protocol/TBinaryProtocol.php(305): Thrift\Transport\TTransport->readAll(4)
#2 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Protocol/TBinaryProtocol.php(197): Thrift\Protocol\TBinaryProtocol->readI32(NULL)
#3 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/EDAM/UserStore/UserStore.php(710): Thrift\Protocol\TBinaryProtocol->readMessageBegin(NULL, 0, 0)
#4 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/EDAM/UserStore/UserStore.php(679): EDAM\UserStore\UserStoreClient->recv_getNoteStoreUrl()
#5 [internal function]: EDAM\UserStore\UserStoreClient->getNot in /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Transport/THttpClient.php on line 163
mytest code
$token = 'S=s1:U=91183:E=155a102c369:C=14e49519440:P=81:A=vb2005xu:V=2:H=fbc6ab62a89ce94507e52a575ecb552c';
$sandbox = true;
$advancedClient = new \Evernote\AdvancedClient($token, $sandbox);
$noteStore = $advancedClient->getNoteStore();
$notebooks = $noteStore->listNotebooks();
prety_printr($notebooks,'--------------');exit;
i have print the error in file Thrift/Transport/THttpClient.php
,this is my modify
<?php
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* @package thrift.transport
*/
namespace Thrift\Transport;
use Thrift\Transport\TTransport;
use Thrift\Exception\TTransportException;
use Thrift\Factory\TStringFuncFactory;
/**
* HTTP client for Thrift
*
* @package thrift.transport
*/
class THttpClient extends TTransport {
/**
* The host to connect to
*
* @var string
*/
protected $host_;
/**
* The port to connect on
*
* @var int
*/
protected $port_;
/**
* The URI to request
*
* @var string
*/
protected $uri_;
/**
* The scheme to use for the request, i.e. http, https
*
* @var string
*/
protected $scheme_;
/**
* Buffer for the HTTP request data
*
* @var string
*/
protected $buf_;
/**
* Input socket stream.
*
* @var resource
*/
protected $handle_;
/**
* Read timeout
*
* @var float
*/
protected $timeout_;
/**
* http headers
*
* @var array
*/
protected $headers_;
/**
* Make a new HTTP client.
*
* @param string $host
* @param int $port
* @param string $uri
*/
public function __construct($host, $port=80, $uri='', $scheme = 'http') {
// if ((TStringFuncFactory::create()->strlen($uri) > 0) && ($uri{0} != '/')) {
// $uri = '/'. $uri;
// }
$uri = '/'. ltrim($uri,'/');
$this->scheme_ = $scheme;
$this->host_ = $host;
$this->port_ = $port;
$this->uri_ = $uri;
$this->buf_ = '';
$this->handle_ = null;
$this->timeout_ = null;
$this->headers_ = array();
}
/**
* Set read timeout
*
* @param float $timeout
*/
public function setTimeoutSecs($timeout) {
$this->timeout_ = $timeout;
}
/**
* Whether this transport is open.
*
* @return boolean true if open
*/
public function isOpen() {
return true;
}
/**
* Open the transport for reading/writing
*
* @throws TTransportException if cannot open
*/
public function open() {}
/**
* Close the transport.
*/
public function close() {
if ($this->handle_) {
@fclose($this->handle_);
$this->handle_ = null;
}
}
/**
* Read some data into the array.
*
* @param int $len How much to read
* @return string The data that has been read
* @throws TTransportException if cannot read any more data
*/
public function read($len) {
$data = fread($this->handle_, $len);var_dump($len,$data);echo "\n";
if ($data === FALSE || $data === '') {
$md = stream_get_meta_data($this->handle_);
if ($md['timed_out']) {
throw new TTransportException('THttpClient: timed out reading '.$len.' bytes from '.$this->host_.':'.$this->port_.$this->uri_, TTransportException::TIMED_OUT);
} else {
throw new TTransportException('THttpClient: Could not read '.$len.' bytes from '.$this->host_.':'.$this->port_.$this->uri_, TTransportException::UNKNOWN);
}
}
return $data;
}
/**
* Writes some data into the pending buffer
*
* @param string $buf The data to write
* @throws TTransportException if writing fails
*/
public function write($buf) {
$this->buf_ .= $buf;
}
/**
* Opens and sends the actual request over the HTTP connection
*
* @throws TTransportException if a writing error occurs
*/
public function flush() {
// God, PHP really has some esoteric ways of doing simple things.
$host = $this->host_.($this->port_ != 80 ? ':'.$this->port_ : '');
$headers = array();
$defaultHeaders = array('Host' => $host,
'Accept' => 'application/x-thrift',
'User-Agent' => 'PHP/THttpClient',
'Content-Type' => 'application/x-thrift',
'Content-Length' => TStringFuncFactory::create()->strlen($this->buf_));
foreach (array_merge($defaultHeaders, $this->headers_) as $key => $value) {
$headers[] = "$key: $value";
}
// prety_printr($this);exit;
$options = array('method' => 'POST',
'header' => implode("\r\n", $headers),
'max_redirects' => 1,
'content' => $this->buf_);
if ($this->timeout_ > 0) {
$options['timeout'] = $this->timeout_;
}
$this->buf_ = '';
$contextid = stream_context_create(array('http' => $options));
stream_context_set_option ( $contextid, 'ssl', 'verify_peer', false );
// $file = file_get_contents($this->scheme_.'://'.$host.$this->uri_, false, $contextid);
// echo $file;
// echo "\n\t";
// exit;
$this->handle_ = fopen($this->scheme_.'://'.$host.$this->uri_, 'r', false, $contextid);
// var_dump($this->handle_);exit;
var_dump($this->scheme_.'://'.$host.$this->uri_);echo "\n";
// Connect failed?
if ($this->handle_ === FALSE) {
$this->handle_ = null;
$error = 'THttpClient: Could not connect to '.$host.$this->uri_;
throw new TTransportException($error, TTransportException::NOT_OPEN);
}
}
public function addHeaders($headers) {
$this->headers_ = array_merge($this->headers_, $headers);
}
}
this is print result:
localhost:xiche_c_apihelper xiaohanxu$ php cli.php pathinfo=/index/evernote/books.json
string(42) "https://sandbox.evernote.com:443/edam/user"
int(4)
string(4) "?"
int(4)
string(4) ""
int(15)
string(15) "getNoteStoreUrl"
int(4)
string(4) ""
int(1)
string(1) "
"
int(2)
string(2) ""
int(4)
string(4) "/"
int(47)
string(47) "https://sandbox.evernote.com/shard/s1/notestore"
int(1)
string(1) ""
int(4)
string(0) ""
PHP Fatal error: Uncaught exception 'Thrift\Exception\TTransportException' with message 'THttpClient: Could not read 4 bytes from sandbox.evernote.com:443/edam/user' in /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Transport/THttpClient.php:163
Stack trace:
#0 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Transport/TTransport.php(74): Thrift\Transport\THttpClient->read(4)
#1 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Protocol/TBinaryProtocol.php(305): Thrift\Transport\TTransport->readAll(4)
#2 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Protocol/TBinaryProtocol.php(197): Thrift\Protocol\TBinaryProtocol->readI32(NULL)
#3 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/EDAM/UserStore/UserStore.php(710): Thrift\Protocol\TBinaryProtocol->readMessageBegin(NULL, 0, 0)
#4 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/EDAM/UserStore/UserStore.php(679): EDAM\UserStore\UserStoreClient->recv_getNoteStoreUrl()
#5 [internal function]: EDAM\UserStore\UserStoreClient->getNot in /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Transport/THttpClient.php on line 163
Fatal error: Uncaught exception 'Thrift\Exception\TTransportException' with message 'THttpClient: Could not read 4 bytes from sandbox.evernote.com:443/edam/user' in /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Transport/THttpClient.php:163
Stack trace:
#0 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Transport/TTransport.php(74): Thrift\Transport\THttpClient->read(4)
#1 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Protocol/TBinaryProtocol.php(305): Thrift\Transport\TTransport->readAll(4)
#2 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Protocol/TBinaryProtocol.php(197): Thrift\Protocol\TBinaryProtocol->readI32(NULL)
#3 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/EDAM/UserStore/UserStore.php(710): Thrift\Protocol\TBinaryProtocol->readMessageBegin(NULL, 0, 0)
#4 /usr/local/var/www/xiche_c_apihelper/app/g/evernote/EDAM/UserStore/UserStore.php(679): EDAM\UserStore\UserStoreClient->recv_getNoteStoreUrl()
#5 [internal function]: EDAM\UserStore\UserStoreClient->getNot in /usr/local/var/www/xiche_c_apihelper/app/g/evernote/Thrift/Transport/THttpClient.php on line 163
localhost:xiche_c_apihelper xiaohanxu$
from evernote-cloud-sdk-php.
i try in windows7 and mac:
$ uname -a
Darwin localhost 14.1.1 Darwin Kernel Version 14.1.1: Thu Feb 26 22:41:49 PST 2015; root:xnu-2782.15.5~1/RELEASE_X86_64 x86_64
from evernote-cloud-sdk-php.
i can run that code only, but other example can not run !
// First, get the right Store
$userStore = $advancedClient->getUserStore();
// Then do the call
$user = $userStore->getUser();
prety_printr($user,'--------------');exit;
from evernote-cloud-sdk-php.
没有人能够解决么?
from evernote-cloud-sdk-php.
Related Issues (20)
- en-todo checked state
- Getting issue with Create Note
- Fatal errors – am I doing something wrong? HOT 5
- is there a http api for evernote ? HOT 1
- A session had already been started - ignoring session_start() HOT 4
- Failed to run add_resource.php
- Any sample for webhook?
- Tag a release HOT 2
- Hive Thrift execution error
- Update "tijsverkoyen/css-to-inline-styles" HOT 2
- Get notes from linked notebooks HOT 2
- How do I get access tokens? HOT 1
- There are not createOrUpdateNotebookShares function
- Uncaught Exception: in ...\wp-content\plugins\evernote-sync\src\EDAM\UserStore\UserStore.php on line 3210
- Undefined index in Client.php
- Array and string offset access syntax with curly braces is deprecated HOT 3
- listNotebooks() fails for specific users
- The SDK response got very slow
- No Code Change - Suddenly: Could Not Connect Error HOT 1
- Web (global) links generated by Evernote API do not open HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evernote-cloud-sdk-php.