Skip to content

Instantly share code, notes, and snippets.

@b1nary
Created July 19, 2016 08:49
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 b1nary/2af44e9b0f072002f007417ddc0e14e9 to your computer and use it in GitHub Desktop.
Save b1nary/2af44e9b0f072002f007417ddc0e14e9 to your computer and use it in GitHub Desktop.
Tweee.co
curl --data "text=Hi there&key=<%= current_api_key %>&media[]=https://example.com/image1.jpg&media[]=https://example.com/image2.jpg" https://tweee.co/api/tweet
var request = require('request');
request.post(
'https://tweee.co/api/tweet',
{ form: {
'key': '<%= current_api_key %>',
'text': 'This is a Tweet! Weee',
'media': [
'https://example.com/image1.jpg',
'https://example.com/image2.jpg'
]
}},
function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body)
}
}
);
$url = 'https://tweee.co/api/tweet';
$fields = array(
'key' => '<%= current_api_key %>',
'text' => 'This is a Tweet! Weee',
'media' => array(
'https://example.com/image1.jpg',
'https://example.com/image2.jpg'
)
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
curl_close($ch);
import requests
url = "https://tweee.co/api/tweet"
data = {
'key': '<%= current_api_key %>',
'text': 'This is a Tweet! Weee',
'media': [
'https://example.com/image1.jpg',
'https://example.com/image2.jpg'
]
}
print requests.get(url, data=data).text
require 'uri'
require 'net/http'
uri = URI("https://tweee.co/api/tweet")
Net::HTTP.post_form(uri, {
key: "<%= current_api_key %>",
text: "This is a Tweet! Weee",
media: [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment