File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 44include 'metacritic.php ' ;
55
66$ metacritic_api = new MetacriticAPI ();
7- $ response = $ metacritic_api ->get_metacritic_page ("The Elder Scrolls V: Skyrim " );
8- $ json_reponse = $ metacritic_api ->get_metacritic_scores ($ response );
7+ $ metacritic_api ->get_metacritic_page ("The Elder Scrolls V: Skyrim " );
8+ $ json_reponse = $ metacritic_api ->get_metacritic_scores ();
99
1010echo "Json Output: \n<br/><br/> " . $ json_reponse ;
1111?>
Original file line number Diff line number Diff line change 44
55class MetacriticAPI
66{
7+ private $ response_body = "" ;
8+
9+ function __construct () {
10+ }
11+
712 public function get_metacritic_page ($ game_name )
813 {
914 $ returnValue = "" ;
@@ -22,13 +27,13 @@ public function get_metacritic_page($game_name)
2227 {
2328 $ returnValue = $ response ->raw_body ;
2429 }
25- return $ returnValue ;
30+ $ this -> response_body = $ returnValue ;
2631 }
2732
28- public function get_metacritic_scores ($ page_response )
33+ public function get_metacritic_scores ()
2934 {
3035 # Get DOM by string content
31- $ html = str_get_html ($ page_response );
36+ $ html = str_get_html ($ this -> response_body );
3237 # Define json output array
3338 $ json_output = array ();
3439 $ error = false ;
You can’t perform that action at this time.
0 commit comments