Advertisement
Aichan

pastebin.php

Jan 6th, 2013
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. <?php
  2. include 'config.php';
  3. $api_paste_code         = $_POST['source']; // your paste text
  4. $api_paste_private      = '0'; // 0=public 1=unlisted 2=private
  5. $api_paste_name         = $_POST['name']; // name or title of your paste
  6. $api_paste_expire_date  = 'N';
  7. $api_paste_format       = 'lua';
  8. $api_user_key           = isset($_COOKIE['api_user_key']) ? $_COOKIE['api_user_key'] : ''; // if an invalid api_user_key or no key is used, the paste will be create as a guest
  9. $api_paste_name         = urlencode($api_paste_name);
  10. $api_paste_code         = urlencode($api_paste_code);
  11.  
  12.  
  13. $url                = 'http://pastebin.com/api/api_post.php';
  14. $ch                 = curl_init($url);
  15.  
  16. curl_setopt($ch, CURLOPT_POST, true);
  17. 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.'');
  18. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  19. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  20. curl_setopt($ch, CURLOPT_NOBODY, 0);
  21.  
  22. $response           = curl_exec($ch);
  23. echo $response;
  24.  
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement