public function Process($url, $profile = "auto", $tempoptions = array())
 {
     $startts = microtime(true);
     $redirectts = $startts;
     if (isset($tempoptions["timeout"])) {
         $timeout = $tempoptions["timeout"];
     } else {
         if (isset($this->data["httpopts"]["timeout"])) {
             $timeout = $this->data["httpopts"]["timeout"];
         } else {
             $timeout = false;
         }
     }
     // Deal with possible application hanging issues.
     if (isset($tempoptions["streamtimeout"])) {
         $streamtimeout = $tempoptions["streamtimeout"];
     } else {
         if (isset($this->data["httpopts"]["streamtimeout"])) {
             $streamtimeout = $this->data["httpopts"]["streamtimeout"];
         } else {
             $streamtimeout = 300;
         }
     }
     $tempoptions["streamtimeout"] = $streamtimeout;
     if (!isset($this->data["httpopts"]["headers"])) {
         $this->data["httpopts"]["headers"] = array();
     }
     $this->data["httpopts"]["headers"] = \CubicleSoft\HTTP::NormalizeHeaders($this->data["httpopts"]["headers"]);
     unset($this->data["httpopts"]["method"]);
     unset($this->data["httpopts"]["write_body_callback"]);
     unset($this->data["httpopts"]["body"]);
     unset($this->data["httpopts"]["postvars"]);
     unset($this->data["httpopts"]["files"]);
     $httpopts = $this->data["httpopts"];
     $numfollow = $this->data["maxfollow"];
     $numredirects = 0;
     $totalrawsendsize = 0;
     if (!isset($tempoptions["headers"])) {
         $tempoptions["headers"] = array();
     }
     $tempoptions["headers"] = \CubicleSoft\HTTP::NormalizeHeaders($tempoptions["headers"]);
     if (isset($tempoptions["headers"]["Referer"])) {
         $this->data["referer"] = $tempoptions["headers"]["Referer"];
     }
     // If a referrer is specified, use it to generate an absolute URL.
     if ($this->data["referer"] != "") {
         $url = \CubicleSoft\HTTP::ConvertRelativeToAbsoluteURL($this->data["referer"], $url);
     }
     $urlinfo = \CubicleSoft\HTTP::ExtractURL($url);
     // Initialize the process state array.
     $state = array("async" => false, "startts" => $startts, "redirectts" => $redirectts, "timeout" => $timeout, "tempoptions" => $tempoptions, "httpopts" => $httpopts, "numfollow" => $numfollow, "numredirects" => $numredirects, "totalrawsendsize" => $totalrawsendsize, "profile" => $profile, "url" => $url, "urlinfo" => $urlinfo, "state" => "initialize", "httpstate" => false, "result" => false);
     // Run at least one state cycle to properly initialize the state array.
     $result = $this->ProcessState($state);
     // Return the state for async calls.  Caller must call ProcessState().
     if ($state["async"]) {
         return array("success" => true, "state" => $state);
     }
     return $result;
 }