3 Replies Latest reply on Jul 24, 2008 11:54 PM by SujitG

    Downloading the contents of a webpage

    dustybray
      Hi everyone,
      I'm trying to use Flex 3 SDK (with the command line) to create an application that downloads the contents of a webpage into a string. I've tried two methods:

      Method #1:

      public function init():void {
      var loader:URLLoader = new URLLoader();
      loader.addEventListener(Event.COMPLETE, completeHandler);
      var request:URLRequest = new URLRequest(" http://www.blinknation.com");
      request.method = URLRequestMethod.GET;
      loader.load(request);
      }

      private function completeHandler(event:Event):void {
      header.text = "asdf";
      var response:URLLoader = URLLoader(event.target);
      var responseData:String = response.data;
      }

      Method #2:

      public function init():void {
      var service:HTTPService = new HTTPService();
      service.url = " http://www.blinknation.com";
      service.useProxy = false;
      service.resultFormat = "text";
      service.addEventListener("result", completeHandler);
      service.send();
      }

      private function completeHandler(event:ResultEvent):void
      var txt:String = String(event.result);
      }


      In both cases, completeHandler is never called. This is just a test, but I would eventually like to send GET variables to a PHP script. Can anyone show me what I should be doing?

      Thanks,

      dusty.......