Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- // This script generates and returns a Pastebin session key. For use with alfred-pastebin.php and the Pastebin Workflow for Alfred (OS X).
- <?php
- $pastebin_pwd = shell_exec('security find-internet-password -wl "[KEYCHAIN PASTEBIN PWD]" | tr -d "\\n"');
- $api_dev_key = shell_exec('security find-generic-password -wl "[KEYCHAIN DEV KEY]" | tr -d "\\n"');
- $api_user_name = '[PASTEBIN USERNAME]';
- $api_user_name = urlencode($api_user_name);
- $api_user_password = urlencode($pastebin_pwd);
- $url = 'https://pastebin.com/api/api_login.php';
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_dev_key='.$api_dev_key.'&api_user_name='.$api_user_name.'&api_user_password='.$api_user_password.'');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- curl_setopt($ch, CURLOPT_NOBODY, 0);
- $response = curl_exec($ch);
- echo $response;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement