Skip to content

Instantly share code, notes, and snippets.

@leedohyung-dba
Last active September 7, 2016 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leedohyung-dba/72e041a86bca05e5a0cb52d5727afbc0 to your computer and use it in GitHub Desktop.
Save leedohyung-dba/72e041a86bca05e5a0cb52d5727afbc0 to your computer and use it in GitHub Desktop.
[PHP][JavaScript]Twitter APIとFacebook APIのそれぞれ違う注意事項・制約事項 ref: http://qiita.com/leedohyung-dba/items/e8e3e39262c3b1caacc7
picture: PHPVALUE.upImage // = http://~
...
'curl_timeout' => 10,
...
// twitterの場合はFacebookと違って、絶対経路(その以外は、エラーが発生されます)を求めています。
// しかし、詳細画像の場合、コンテンツデザインなので、実際の画像が存在しません。(urlで接続するべき)
// そのため、ストリームをコピーして使っています。
$tmp = tmpfile();
stream_copy_to_stream(fopen($up_twitter_image, 'rb'), $tmp);
$streamGetMetaData = stream_get_meta_data($tmp);
$params = array(
'media[]' => '@' . $streamGetMetaData['uri'],
'status' => "{$up_twitter_content}"
);
$endpoint = $tmhOAuth->url('1.1/statuses/update_with_media');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment