topical media & game development

talk show tell print

mashup-amazon-09-09-01-MovieMogul-getdata.aspx.cs / cs



  using System;
  using System.Data;
  using System.Configuration;
  using System.Collections;
  using System.Web;
  using System.Web.Security;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Web.UI.WebControls.WebParts;
  using System.Web.UI.HtmlControls;
  using System.Xml;
  
  public partial class getdata : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          // If this page was passed any keywords, then GetResults
          GetResults();
      }
  
      void GetResults()
      {
          string strURI = "";
  
          // Is this a Youtube api call or an Amazon call? 
          if (Request.Params["api"] == "youtube")
          {
              // a YouTube URI
              strURI = "http://www.youtube.com/api2_rest?method=youtube.videos.list_by_tag&dev_id=[YOUR ID HERE]&tag=" + Request.Params["tag"];
          }
          else
          {
              // Build an Amazon URI
              strURI = amazonUtility.BuildAmazonURI(Request.QueryString);
          }
  
          // Obtain the data
          XmlDocument myDoc = webUtility.GetUri(strURI);
  
          // If the data passed back is ok
          if (myDoc != null)
          {
              Response.Clear();
              // Uncomment these line if you need to debug the transformed xml
              //Response.ContentType = "text/xml";
              //Response.Write(myDoc.InnerXml);
              //Response.End();
              string strResults = webUtility.DoXSLTransformation(myDoc, "AmazonYouTube.xsl");
              Response.Write(strResults);
  
          }
      }
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.