This is the first PHP code I have written in YEARS, so any comments would be welcome! I am in the middle of writing a MediaWiki extension for BrowserID and thought this might help some people out who are looking to get started with plugins of their own.

I am using cURL to do the actual verification, the only thing that baffles me is how the response to the cURL request gets returned as the value of the GET request that calls this code. Any suggestions/reasons would be greatly appreciated!


Class BrowserIDVerify {
  public static function login($audience, $assertion) {
    $url = "";
    $data = array(
    return BrowserIDVerify::do_post_request($url, $data);

  private static function do_post_request($url, $data) {
    $data_string = http_build_query($data);

    $ch = curl_init();
    $result = curl_exec($ch);
    $info = curl_getinfo($ch);


    // If anybody could explain to me how/why the result gets returned
    // as the response to the initial GET request that calls this code,
    // I'd be very grateful.
    return '';