私は自分のアプリを介して、ユーザーに代わってユーザーの壁に画像を投稿しています (イベントでカメラの前に立ちます)。私のアプリは先週正常に機能していましたが、現在は機能しておらず、「未解決の応答を待っている間に EOF を取得しました」と報告しています。
関連するバグ レポートがありますが、それは iPhone アプリ用ですが、私のアプリは Web ベースの php です。
誰でもこのエラーメッセージに光を当てることができますか? 私のコードは以下にありますが、pic 処理と db 呼び出しのために分解されています..
//initial calling code
$data = array('title' => $station_info->title,
'message' => $station_info->message,
'token' => $result['access_token'],
'item' => $item,
'pic_source' => $image,
'fb_id' => $result['fb_id'],
'album_id' => $station_info->pic_station_album_id,
'user_id' => $user_id_data['id'],
);
//$result = $this->__do_facebook_image_post($data);
$feedback = "FACEBOOKIMG: " . $this->__do_facebook_image_post($data, 'x');
///processing code
private function __do_facebook_image_post($data,$type = "normal"){
$attachment = array(
'title' => $data['title'],
'message' => $data['message'],
'token' => $data['token']
);
if($type =="normal"){
$folder = "webcam";
}else if($type="x"){
$folder = "x";
}
$upload_path = FCPATH . "/pic_uploads/".$folder."/".$data['item'];
echo $upload_path;
if(is_file($upload_path))
{
$attachment['source'] = '@' . realpath(FCPATH . "/img_uploads/".$folder."/". $upload_path);
}
else
{
$attachment['source'] = '@' . realpath(FCPATH . "/img_uploads/".$folder."/". $data['pic_source']);
}
return $this->facebook_img_post($data['fb_id'],$attachment,$this->__get_facebook_album_id($data['album_id'],$data['user_id'],$data['token']),$data['token']);
}
private function __do_facebook_image_post($data,$type = "normal"){
$attachment = array(
'title' => $data['title'],
'message' => $data['message'],
'token' => $data['token']
);
if($type =="normal"){
$folder = "webcam";
}else if($type="x"){
$folder = "x";
}
$upload_path = FCPATH . "/pic_uploads/".$folder."/".$data['item'];
echo $upload_path;
if(is_file($upload_path))
{
$attachment['source'] = '@' . realpath(FCPATH . "/img_uploads/".$folder."/". $upload_path);
}
else
{
$attachment['source'] = '@' . realpath(FCPATH . "/img_uploads/".$folder."/". $data['pic_source']);
}
return $this->facebook_img_post($data['fb_id'],$attachment,$this->__get_facebook_album_id($data['album_id'],$data['user_id'],$data['token']),$data['token']);
}
private function __post_to_facebook($url,$attachment)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // This i added as the URL is https
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // This i added as the URL is https
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, true); // Do I need this ?
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
$result= curl_exec($ch);
curl_close ($ch);
return $result;
}
function facebook_img_post($fb_id,$data,$album_id ='')
{
if(!empty($album_id)){
$url = "https://graph.facebook.com/".$album_id."/photos";
}else{
$url = "https://graph.facebook.com/".$fb_id."/photos";
}
$attachment = array(
'access_token' => $data['token'],
'message'=> $data['message'],
'source' => $data['source'] . ";type=".get_mime_by_extension($data['source'])
);
return $this->__post_to_facebook($url,$attachment);
}