File tree Expand file tree Collapse file tree 2 files changed +10
-25
lines changed Expand file tree Collapse file tree 2 files changed +10
-25
lines changed Original file line number Diff line number Diff line change @@ -135,26 +135,13 @@ protected function setUpXml(array $arguments = [])
135135 return simplexml_load_file ($ steamUrl . '? ' . $ parameters );
136136 }
137137
138- public function getRedirectUrl ()
139- {
140- $ ch = curl_init ();
141- curl_setopt ($ ch , CURLOPT_URL , $ this ->url );
142- curl_setopt ($ ch , CURLOPT_HEADER , true );
143- curl_setopt ($ ch , CURLOPT_FOLLOWLOCATION , true );
144- curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , true );
145-
146- curl_exec ($ ch );
147- $ this ->url = curl_getinfo ($ ch , CURLINFO_EFFECTIVE_URL );
148- curl_close ($ ch );
149- }
150-
151138 /**
152- * @param \GuzzleHttp\Psr7\Request $request
139+ * @param \Guzzle\Http\Message\RequestInterface $request
153140 *
154- * @return \stdClass
155- * @throws \Syntax\SteamApi\Exceptions\ApiCallFailedException
141+ * @throws ApiCallFailedException
142+ * @return stdClass
156143 */
157- protected function sendRequest (Request $ request )
144+ protected function sendRequest ($ request )
158145 {
159146 // Try to get the result. Handle the possible exceptions that can arise
160147 try {
Original file line number Diff line number Diff line change @@ -80,17 +80,15 @@ public function GetPlayerAchievements($appId)
8080 return $ achievements ;
8181 } catch (\Exception $ e ) {
8282 // In rare cases, games can force the use of a simplified name instead of an app ID
83- // In these cases, try again by grabbing the redirected url .
83+ // In these cases, try again with the name .
8484 if (is_int ($ appId )) {
85- $ this ->getRedirectUrl ( );
85+ $ app = $ this ->app ()-> appDetails ( $ appId );
8686
87- // Get the client
88- $ client = $ this -> setUpXml ( $ arguments );
87+ if ( isset ( $ app -> first ()-> name )) {
88+ $ appName = str_replace ( ' ' , '' , $ app -> first ()-> name );
8989
90- // Clean up the games
91- $ achievements = $ this ->convertToObjects ($ client ->achievements ->achievement );
92-
93- return $ achievements ;
90+ return $ this ->GetPlayerAchievements ($ appName );
91+ }
9492 }
9593
9694 // If the name and ID fail, return null.
You can’t perform that action at this time.
0 commit comments