Exemple #1
0
        // End: GetMusicBrainzID

        private static string GetHTMLFromUrl(string url)
        {
            logger.Debug("Sending the request: " + url);

            try
            {
                mvWebGrabber grabber = Utility.GetWebGrabberInstance(url);
                grabber.Encoding         = System.Text.Encoding.UTF8;
                grabber.Timeout          = 5000;
                grabber.TimeoutIncrement = 10;
                if (grabber.GetResponse())
                {
                    return(grabber.GetString());
                }
            }
            catch (Exception ex)
            {
                logger.Debug("GetHTMLFromUrl: ERROR: " + ex);
            }
            return(null);
        }
Exemple #2
0
        // given a url, retrieves the xml result set and returns the nodelist of Item objects
        private static XmlDocument getXML(string url)
        {
            XmlDocument xmldoc = new XmlDocument();

            logger.Debug("Sending the request: " + url.Replace("eadfb84ac56eddbf072efbfc18a90845", "<apiKey>"));

            mvWebGrabber grabber = Utility.GetWebGrabberInstance(url);

            grabber.Encoding         = Encoding.UTF8;
            grabber.Timeout          = 5000;
            grabber.TimeoutIncrement = 10;
            grabber.Method           = "POST";
            if (grabber.GetResponse())
            {
                return(grabber.GetXMLDoc());
            }
            else
            {
                logger.Debug("***** API ERROR *****: Code:{0} ({1})", grabber.errorCode, grabber.errorText);
                return(null);
            }
        }