Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pastebin API
#1
Pastebin has an API that makes it possible (if I understood correctly):
- create paste
- get url of newly created paste

Below PHP example code from the website (API section): http://pastebin.com/api (sending the data as the UTF-8 charset!)

PHP version to create paste (is the only example):

Code:
Copy      Help
$api_dev_key = 'YOUR API DEVELOPER KEY'; // your api_developer_key
$api_paste_code = 'just some random text you :)'; // your paste text
$api_paste_private = '1'; // 0=public 1=unlisted 2=private
$api_paste_name = 'justmyfilename.php'; // name or title of your paste
$api_paste_expire_date = '10M';
$api_paste_format = 'php';
$api_user_key = ''; // if an invalid api_user_key or no key is used, the paste will be create as a guest
$api_paste_name = urlencode($api_paste_name);
$api_paste_code = urlencode($api_paste_code);

$url = 'http://pastebin.com/api/api_post.php';
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=paste&api_user_key='.$api_user_key.'&api_paste_private='.$api_paste_private.'&api_paste_name='.$api_paste_name.'&api_paste_expire_date='.$api_paste_expire_date.'&api_paste_format='.$api_paste_format.'&api_dev_key='.$api_dev_key.'&api_paste_code='.$api_paste_code.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_NOBODY, 0);

$response = curl_exec($ch);
echo $response;

Is it possible use this API in QM?

Macro Macro12
Code:
Copy      Help
typelib WinHttp {662901FC-6951-4854-9EB2-D9A2570F2B2E} 5.1
WinHttp.WinHttpRequest r._create
r.Open("POST" "http://pastebin.com/api/api_post.php")
r.Send()

The goal is to create a new paste and if possible to fetch the url of the newly create paste?

IWinHttpRequest::Open method: => https://msdn.microsoft.com/nl-nl/librar ... 89(v=vs.85).aspx

I thought I could do this, but it's over my head this.
#2
Pastebin


Forum Jump:


Users browsing this thread: 1 Guest(s)