Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'config.php';
- $api_user_name = $_POST['user'];
- $api_user_password = $_POST['password'];
- $api_user_name = urlencode($api_user_name);
- $api_user_password = urlencode($api_user_password);
- $url = 'http://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);
- if(strncmp($response, "Bad API request", 15) != 0) {
- setcookie("api_user_key", $response, strtotime( '+30 days' ));
- echo 'Cookie set (Omnomnomnomnom)';
- } else echo $response;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement