/** * Save this file as auth_local.php after you put in your server info. */ function get_bb() { // your bb server base url $server = "https://your.bbserver.tld/"; $blackboard = new BbPhp($server); // this is proxy info which you can get from the // System Admin > Building Blocks > Proxy Tools > Edit Proxy Tool // page, once the proxy tool has been created $results = $blackboard->Context("loginTool", array("password" => "shared_password_from_page", "clientVendorId" => "listed as Vendor", "clientProgramId" => "listed as Program", "loginExtraInfo" => "", "expectedLifeSeconds" => 5000)); if ($results) { return $blackboard; } else { echo "<h4>Outcome of attempted Login Tool method."; echo "<pre>" . print_r($results, true) . "</pre>"; return $results; } }
pre { background-color: #C8DBDB; margin: 20px 20px 20px 20px; padding: 20px 20px 20xp 20px; } </style> <link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css"> </head> <body> <?php //Set the blackboard server your using $server = "http://bb9test.stedwards.edu"; //Init the Blackboard object $blackboard = new BbPhp($server); //Use the information matching a registered Proxy Tool to login $results = $blackboard->Context("loginTool", array("password" => "MassiveNinjasEpicSlurpees", "clientVendorId" => "aaron_proxy", "clientProgramId" => "example_tool", "loginExtraInfo" => "", "expectedLifeSeconds" => 5000)); if ($results == TRUE) { //Calling a method WITH required fields. $results = $blackboard->Context("getMemberships", array("userid" => "aaronm")); /** * Blackboard returns a multidimensional array, unless user has only one course, the its singular. * We fix this, because it is annoying. Start a list of the users courses with the course external id. * */ $courses = array(); if (count($results) == count($results, COUNT_RECURSIVE)) { $courses[0]['externalId'] = $results['externalId']; } else { foreach ($results as $result) {