Ejemplo n.º 1
0
            if (isset($_REQUEST['set_link'])) {
                $postBody = true;
                $response = sendOAuthBody("PUT", $link_url, $oauth_consumer_key, $oauth_consumer_secret, $content_type, $settings);
                $debugin = get_body_sent_debug();
                $debugout = get_body_received_debug();
            } else {
                if (isset($_REQUEST['set_tool'])) {
                    $postBody = true;
                    $response = sendOAuthBody("PUT", $tool_url, $oauth_consumer_key, $oauth_consumer_secret, $content_type, $settings);
                    $debugin = get_body_sent_debug();
                    $debugout = get_body_received_debug();
                } else {
                    if (isset($_REQUEST['set_proxy'])) {
                        $postBody = true;
                        $response = sendOAuthBody("PUT", $proxy_url, $oauth_consumer_key, $oauth_consumer_secret, $content_type, $settings);
                        $debugin = get_body_sent_debug();
                        $debugout = get_body_received_debug();
                    } else {
                        exit;
                    }
                }
            }
        }
    }
}
global $LastOAuthBodyBaseString;
$lbs = $LastOAuthBodyBaseString;
ltiUtilTogglePre("Sent Headers", $debugin);
if ($postBody !== false) {
    ltiUtilTogglePre("Our Body Data", indent($settings));
}
Ejemplo n.º 2
0
echo "reg_password="******"\n";
echo "</pre>\n";
if (strlen($register_url) < 1 || strlen($reg_key) < 1 || strlen($reg_password) < 1) {
    die("Cannot call register_url - insufficient data...\n");
}
unset($_SESSION['reg_key']);
unset($_SESSION['reg_password']);
$_SESSION['reg_key'] = $reg_key;
$_SESSION['reg_password'] = $reg_password;
togglePre("Registration Request", htmlent_utf8($body));
$more_headers = array();
if ($lti_message_type == "ToolProxyReregistrationRequest") {
    $more_headers[] = 'VND-IMS-CONFIRM-URL: ' . $cur_base . 'tp_commit.php?correlation=49201-48842';
}
$response = sendOAuthBody("POST", $register_url, $reg_key, $reg_password, "application/vnd.ims.lti.v2.toolproxy+json", $body, $more_headers);
togglePre("Registration Request Headers", htmlent_utf8(get_body_sent_debug()));
global $LastOAuthBodyBaseString;
togglePre("Registration Request Base String", $LastOAuthBodyBaseString);
togglePre("Registration Response Headers", htmlent_utf8(get_body_received_debug()));
togglePre("Registration Response", htmlent_utf8(json_indent($response)));
$tc_half_shared_secret = false;
if ($last_http_response == 201 || $last_http_response == 200) {
    if ($oauth_splitsecret && $tp_half_shared_secret) {
        $responseObject = json_decode($response);
        if (isset($responseObject->tc_half_shared_secret)) {
            $tc_half_shared_secret = $responseObject->tc_half_shared_secret;
            echo "<p>tc_half_shared_secret: " . $tc_half_shared_secret . "</p>\n";
            if (strlen($tc_half_shared_secret) != 128) {
                echo '<p style="color: red">Warning secret length of ' . strlen($tc_half_shared_secret) . " should be 128</p>\n";
            }
            $split_secret = $tc_half_shared_secret . $tp_half_shared_secret;
Ejemplo n.º 3
0
    }
}
$response = sendOAuthBody($method, $endpoint, $oauth_consumer_key, $oauth_consumer_secret, $content_type, $postBody);
global $LastOAuthBodyBaseString;
$lbs = $LastOAuthBodyBaseString;
global $LastPOSTHeader;
$lph = $LastPOSTHeader;
try {
    $retval = parseResponse($response);
} catch (Exception $e) {
    $retval = $e->getMessage();
}
echo "\n<pre>\n";
echo "Service Url:\n";
echo htmlent_utf8($endpoint) . "\n\n";
echo get_body_sent_debug();
print_r($retval);
echo "\n";
echo "------------ POST RETURNS ------------\n";
$response = str_replace("><", "&gt;\n&lt;", $response);
$response = str_replace("<", "&lt;", $response);
$response = str_replace(">", "&gt;", $response);
echo $response;
echo "\n\n------------ WE SENT ------------\n";
echo get_body_received_debug();
echo "\n";
$postBody = str_replace("<", "&lt;", $postBody);
$postBody = str_replace(">", "&gt;", $postBody);
echo $postBody;
echo "\n\nBase String:\n";
echo $lbs;