<?php
$key = 'YOUR CONSUMER KEY';
$secret = 'YOUR CONSUMER SECRET';
$appid = 'YOUR APPLICATION ID';

$debug = true;
$base_url = "http://www.yoursite.com/complete.php";
$request_token_endpoint = 'https://api.login.yahoo.com/oauth/v2/get_request_token';
$authorize_endpoint = 'https://api.login.yahoo.com/oauth/v2/request_auth';
$oauth_access_token_endpoint = 'https://api.login.yahoo.com/oauth/v2/get_token';

/***************************************************************************
 * Funkcja: uruchom CURL
 * Opis: wykonuje żądanie CURL
 * Parametry: url (łańcuch) - adres URL, na który zostanie wysłane żądanie
 *         method (łańcuch) - metoda transferu protokołu HTTP
 *         headers - nagłówki transferu protokołu HTTP
 *         postvals - wartości POST
 **************************************************************************/
function run_curl($url, $method = 'GET', $headers = null, $postvals = null){
    $ch = curl_init($url);
    
    if ($method == 'GET'){
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    } else {
        $options = array(
            CURLOPT_HEADER => true,
            CURLINFO_HEADER_OUT => true,
            CURLOPT_VERBOSE => true,
            CURLOPT_HTTPHEADER => $headers,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_POSTFIELDS => $postvals,
            CURLOPT_CUSTOMREQUEST => $method,
            CURLOPT_TIMEOUT => 3
        );
        curl_setopt_array($ch, $options);
    }
    
    $response = curl_exec($ch);
    curl_close($ch);
    
    return $response;
}
?>
