Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $api_dev_key = 'YOUR API DEVELOPER KEY';
- $api_user_key = '';
- $api_paste_key = '';
- $url = 'https://pastebin.com/api/api_post.php';
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=delete&api_user_key='.$api_user_key.'&api_dev_key='.$api_dev_key.'&api_paste_key='.$api_paste_key.'');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- curl_setopt($ch, CURLOPT_NOBODY, 0);
- $response = curl_exec($ch);
- echo $response;
- Possible Good API Responses:
- Paste Removed
- Possible Bad API Responses:
- Bad API request, invalid api_option
- Bad API request, invalid api_dev_key
- Bad API request, invalid api_user_key
- Bad API request, invalid permission to remove paste
- Getting A Users Information And Settings
- With this API you can obtain a users personal information and certain settings. You will need to send a valid POST request to the url below to access the data:
- https://pastebin.com/api/api_post.php
- Include all the following POST parameters when you request the url:
- 1. api_dev_key - this is your API Developer Key, in your case: YOUR API DEVELOPER KEY
- 2. api_user_key - this is the session key of the logged in user. How to obtain such a key
- 3. api_option - set as 'userdetails'
- Below is a PHP example using curl how to create a valid 'api_user_key':
- $api_dev_key = 'YOUR API DEVELOPER KEY';
- $api_user_key = '';
- $url = 'https://pastebin.com/api/api_post.php';
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=userdetails&api_user_key='.$api_user_key.'&api_dev_key='.$api_dev_key.'');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- curl_setopt($ch, CURLOPT_NOBODY, 0);
- $response = curl_exec($ch);
- echo $response;
- Below is an example output of a user information listing:
- <user>
- <user_name>wiz_kitty</user_name>
- <user_format_short>text</user_format_short>
- <user_expiration>N</user_expiration>
- <user_avatar_url>https://pastebin.com/cache/a/1.jpg</user_avatar_url>
- <user_private>1</user_private> (0 Public, 1 Unlisted, 2 Private)
- <user_website>https://myawesomesite.com</user_website>
- <user_email>oh@dear.com</user_email>
- <user_location>New York</user_location>
- <user_account_type>1</user_account_type> (0 normal, 1 PRO)
- </user>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement