Pecl OAuth Post Image

时间:2015-04-06 10:01:51

标签: php image oauth pecl

我在通过pecl oauth将图片发布到服务器(特定网址)时遇到问题。我一直在谷歌搜索它,但还没有得到答案。

我正在使用此代码:

function postData($url, $token,$data=null){
        $oauth = new OAuth(OAUTH_CONSUMER_KEY,OAUTH_CONSUMER_SECRET);
        $oauth->disableSSLChecks();
        $oauth->setToken($token->key,$token->secret);
        $oauth->fetch($url,$data, OAUTH_HTTP_METHOD_POST);
        return $oauth->getLastResponse();
    }

function questionPost(){
        $user_auth = $this->session->userdata('login_user');
        $content =  $this->input->post('content');
        $aExtraInfo = getimagesize($_FILES['image']['tmp_name']);   
        $sImage = "data:" . $aExtraInfo["mime"] . ";base64," . base64_encode(file_get_contents($_FILES['image']['tmp_name']));
        $data = array(
            "content"=>$content,
            "attachment"=>$sImage
        );
        $url = "https://externalURL";
        $this->function_model->postData($url, $user_auth->accessToken, $data);
        echo json_encode(array("status"=>"success","message"=>"success"));
    }

运行questionPost();

后出现错误500

真的很感激任何答案。

0 个答案:

没有答案