                     let params: [String: AnyObject] = [
                         "code_perm": code_perm,
                         "nip": nip,
-                        ]
+                        "service": "authentification",
+                    ]
                     return ("/proxy_dossier_etud.php", .POST, params)
-                
+                    
                     
                 }
-            }()
+                }()
             
             // Setup the URLRequest.
             let url = NSURL(string: Router.baseURL)
             let urlRequest = NSMutableURLRequest(URL: url!.URLByAppendingPathComponent(path))
             urlRequest.HTTPMethod = method.rawValue
+            urlRequest.addValue("Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.4 Safari/537.36", forHTTPHeaderField: "User-Agent")
+            urlRequest.addValue("application/x-www-form-urlencoded; charset=UTF-8", forHTTPHeaderField: "Content-Type")
+            urlRequest.addValue("text/plain, */*; q=0.01", forHTTPHeaderField: "Accept")
+            urlRequest.addValue("XMLHttpRequest", forHTTPHeaderField: "X-Requested-With")
+            urlRequest.addValue("https://mobile.uqam.ca/portail_etudiant/", forHTTPHeaderField: "Referer")
+            urlRequest.addValue("no-cache", forHTTPHeaderField: "Pragma")
+            urlRequest.addValue("mobile.uqam.ca", forHTTPHeaderField: "Host")
+            urlRequest.addValue("Origin", forHTTPHeaderField: "https://mobile.uqam.ca")
+            urlRequest.addValue("gzip, deflate", forHTTPHeaderField: "Accept-Encoding")
             if let code_perm = Router.code_perm {
                 if let nip = Router.nip{
                     
-                parameters["nip"] = nip
-                parameters["code_perm"] = code_perm
+                    parameters["nip"] = nip
+                    parameters["code_perm"] = code_perm
                 }
             }
-
-            let encoding = Alamofire.ParameterEncoding.PropertyList(NSPropertyListFormat.XMLFormat_v1_0, 0)
+            
+            let encoding = Alamofire.ParameterEncoding.URL;
             return encoding.encode(urlRequest, parameters: parameters).0
         }
     }

    }
    private init() {}
    

    
    // Login logs in the user with his email and password.
    func login(code_perm:String, nip:String, callback:(LoginResponse?) -> Void) {
        Alamofire.request(Router.Login(code_perm, nip)).responseJSON { (_, _, data, error) in
            if(error != nil) {
                println(error)
                callback(nil)
                return
            }
            
            var json = JSON(data!)
            
            let prenom = json["socio"]["prenom"].stringValue
            let nom = json["socio"]["nom"].stringValue
            
            Router.code_perm = code_perm
            Router.nip = nip
           
            callback(LoginResponse(
                user: User(prenom: prenom, nom: nom)
                
            ))
        }
    }

        
        
        // stores the authentication token.
        static var code_perm: String?
        static var nip:String?
        
        // Login request.
        case Login(String, String)
        
        
        // URLRequestConvertible protocol.
        var URLRequest: NSURLRequest {
