$value) { $base .= "$key=" . urlencode($value) . "&"; } $base = substr($base,0,-1); $url = "$base"; $xml = file_get_contents($url); return ($xml); } function PhanfareLogin($phanfare_account, $phanfare_password) { /* Log into Phanfare with the sideload API Key */ $params = array( 'method' => "Auth.startSession", 'api_key' => "Lq62JmEpChazlehbw9Ty" ); $xml = query_api($params); #print_r($xml); if (parse_xml($xml, $vals, $index)) { $sessionID = $vals[$index['SESSION_ID'][0]]['attributes']['SESSION_ID']; echo "\nGot a Session ID\nSessionID: $sessionID\n"; } else { die ("Failed to get a Session ID, can not continue\n"); } $params = array( 'method' => "Auth.authenticateOwner", 'api_key' => "Lq62JmEpChazlehbw9Ty", 'session_id' => $sessionID, 'username' => $phanfare_account, 'password' => $phanfare_password ); $xml = query_api($params); if (parse_xml($xml, $vals, $index)) { $response = $vals[$index['RSP'][0]]['attributes']['STAT']; echo "\nGot a response: $response\n"; } else { die ("Failed to get a Session ID, can not continue\n"); } return ($sessionID); } ?>