Jump to content

drstumptown

New Members
  • Posts

    9
  • Joined

  • Last visited

drstumptown's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I appreciate your feedback and the semantics -- but my question still persists. Your option 1, above printed exactly as I had it in the beginning; and your second set of snippet print, including this type of data (below) array(10) { [0]=> array(9) { ["Content"]=> string(88) I understand this is a multistage question; but still I'm just trying to grab the data to use it, format / filter per; like you mentioned to get ['content']. Yes, I also understand this isn't senior PHP, thanks again for the responses.
  2. didn't work, dude. Still blank.. <?php $query_params = array( // Specify your developer key 'key' => 'XXXDEVELOPERKEY', ); $getdata = http_build_query($query_params); $opts = array('http' => array( 'method' => 'GET', 'content' => $getdata ) ); $context = stream_context_create($opts); $response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context); $data = json_decode($response,true); echo $data['Content']; ?>
  3. Thank you for your candor, but... <?php $query_params = array( // Specify your developer key 'key' => 'XXXValidDeveloperKey', ); $getdata = http_build_query($query_params); $opts = array('http' => array( 'method' => 'GET', 'content' => $getdata ) ); $context = stream_context_create($opts); $response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context); $data = json_decode($response,true); $data['Content']; ?> is still white screening it.
  4. Ah ha - so: $response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context); $data['Content']; /* or interchanged with the piece of data I want ['NewsID'] ['PlayerId'] etc */ Actually this resulted in the blank white screen again.
  5. Here is the full output though; (below) I want to grab it with PHP I guess as I did; but whatever I need to do with JSON to be able to use it. Really appreciate the help! [{"Content":"The Cardinals have offered free agent ILB Karlos Dansby a two-year deal worth $10 million to $12 million.","NewsID":9701,"PlayerID":11658,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"Cardinals make Dansby 2-year, $10-12M offer","Updated":"\/Date(1394399340000-0400)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/2663\/karlos-dansby"},{"Content":"Cardinals signed TE John Carlson to a two-year, $4.65 million contract.","NewsID":9679,"PlayerID":null,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"Cards sign TE Carlson to 2-year, $4.65M deal","Updated":"\/Date(1394226180000-0500)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/4674\/john-carlson"},{"Content":"In a post he wrote for the Huffington Post, free agent Rashard Mendenhall hinted he could retire.","NewsID":9575,"PlayerID":3931,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"Free agent RB Mendenhall hints he may retire","Updated":"\/Date(1393355400000-0500)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/4652\/rashard-mendenhall"},{"Content":"Speaking at the Combine on Friday, coach Bruce Arians said the Cardinals "want to build our offense around" Andre Ellington.","NewsID":9539,"PlayerID":15224,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"Cardinals to 'build offense around' Ellington","Updated":"\/Date(1392998880000-0500)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/8388\/andre-ellington"},{"Content":"GM Steve Keim reiterated that the Cardinals will use multiple backs going forward.","NewsID":9524,"PlayerID":15224,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"GM Keim says Cardinals will use multiple RBs","Updated":"\/Date(1392914220000-0500)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/8388\/andre-ellington"},{"Content":"According to "two NFL sources," Larry Fitzgerald has agreed only to a "simple restructuring," and not a pay cut.","NewsID":9452,"PlayerID":5571,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"Report: Fitz agrees to 'simple restructuring'","Updated":"\/Date(1391556720000-0500)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/1661\/larry-fitzgerald"},{"Content":"Larry Fitzgerald has agreed to a restructured contract.","NewsID":9451,"PlayerID":5571,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"Fitzgerald agrees to restructured contract","Updated":"\/Date(1391551320000-0500)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/1661\/larry-fitzgerald"},{"Content":"Larry Fitzgerald says he's "absolutely" willing to restructure his contract.","NewsID":9421,"PlayerID":5571,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"Fitz 'absolutely' willing to redo contract","Updated":"\/Date(1391106660000-0500)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/1661\/larry-fitzgerald"},{"Content":"According to an "individual" CSN New England's Tom Curran believes "without reservation," the Patriots were interested in acquiring Larry Fitzgerald last offseason.","NewsID":9408,"PlayerID":5571,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"Report: Pats were interested in Fitz in 2013","Updated":"\/Date(1390943760000-0500)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/1661\/larry-fitzgerald"},{"Content":"Cardinals DB Tyrann Mathieu (torn ACL, LCL) is expected to require a six-to-nine month recovery timetable.","NewsID":9310,"PlayerID":15226,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". If you provide this attribution with a graphic, please use the NBCSports.com logo that we have included in the feed itself. We reserve all rights in and to the NBCSports.com logo, and your right to use the NBCSports.com logo is limited to providing attribution in connection with these RSS feeds. By using the NBCSports.com RSS news feed, you agree to be bound by the NBCSports.com Terms and Conditions. NBCSports.com reserves the right to modify these Terms of Use and the Terms of Service referenced above from time to time and without notice. Msnbc.com reserves the right to cease offering these feeds at any time or require you to cease distributing these feeds at any time for any reason.","Title":"Tyrann Mathieu (knee) has 6-9 month timetable","Updated":"\/Date(1389913800000-0500)\/","Url":"http:\/\/www.rotoworld.com\/player\/nfl\/8387\/tyrann-mathieu"}]
  6. Hey, thanks a bunch for the responses; I'm confused with your last suggestion. Did I replace the snippet incorrectly? Yes, I know it's outputting in bad format that's why I'm here. Basically I'm trying to figure out how to grab, format, filter the data. If JSON, then from PHP > JSON I suppose. When I echo it, previous to your snippet suggestion; it just plasters miles of data like: (I want to grab say 'Source' or etc and format?) [{"Content":"The Cardinals have offered free agent ILB Karlos Dansby a two-year deal worth $10 million to $12 million.","NewsID":9701,"PlayerID":11658,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". etc etc Maybe: file_get_contents Isn't the best approach?
  7. Ah - ha!!!!! so your telling me to replace: echo $response; with $data = json_decode($response); and then Mai Thais and yachts?! ah, spoke to soon; white screen of death occurs...
  8. Hello all, Fairly newb when it comes to this kind of PHP; OK, so I am using NFL Data API https://developer.nfldata.com/docs/services/231 to create a small web app. Below I'm pulling the data from the API but it outputs all over the place with way extra sytnax and attributes. <?php $query_params = array( // Specify your developer key 'key' => 'XXXValidDeveloperKey', ); $getdata = http_build_query($query_params); $opts = array('http' => array( 'method' => 'GET', 'content' => $getdata ) ); $context = stream_context_create($opts); $response = file_get_contents('http://api.nfldata.apiphany.com/developer/JSON/NewsByTeam/ARI?'.$getdata, false, $context); echo $response; ?> Example of output. [{"Content":"The Cardinals have offered free agent ILB Karlos Dansby a two-year deal worth $10 million to $12 million.","NewsID":9701,"PlayerID":11658,"Source":"NBCSports.com","Team":"ARI","TermsOfUse":"NBCSports.com feeds in the RSS format are provided free of charge for use by individuals for personal, non-commercial uses. Attribution to NBCSports.com must be provided in connection with your use of the feeds. If you provide this attribution in text, please use: \"NBCSports.com\". Wondering how to filter the data to pull out nice and formatted using PHP? And then MAYBE, just MAYBE, I can grab specific pieces of it; eg: NewsID etc. Thanks for any assistance!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.