From 445d2b2c32f676def3339974a24ea897bd04d759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Tue, 17 Feb 2009 13:13:27 +0000 Subject: [PATCH] remove dependency on curl git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1282 44740490-163a-0410-bde0-09ae8108e29a --- modules/authYubiKey/libextinc/Yubico.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/authYubiKey/libextinc/Yubico.php b/modules/authYubiKey/libextinc/Yubico.php index 740bee5c9..9dba9a2d8 100644 --- a/modules/authYubiKey/libextinc/Yubico.php +++ b/modules/authYubiKey/libextinc/Yubico.php @@ -127,13 +127,9 @@ class Auth_Yubico /* Support https. */ $url = "https://api.yubico.com/wsapi/verify?" . $parameters; - $ch = curl_init($url); - curl_setopt($ch, CURLOPT_USERAGENT, "PEAR Auth_Yubico"); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $this->_response = curl_exec($ch); - curl_close($ch); + $responseMsg = file_get_contents($url); - if(!preg_match("/status=([a-zA-Z0-9_]+)/", $this->_response, $out)) { + if(!preg_match("/status=([a-zA-Z0-9_]+)/", $responseMsg, $out)) { throw new Exception('Could not parse response'); } @@ -141,7 +137,7 @@ class Auth_Yubico /* Verify signature. */ if($this->_key <> "") { - $rows = split("\r\n", $this->_response); + $rows = split("\r\n", $responseMsg); while (list($key, $val) = each($rows)) { // = is also used in BASE64 encoding so we only replace the first = by # which is not used in BASE64 $val = preg_replace('/=/', '#', $val, 1); -- GitLab