private function _setPageContent($url, __SiteMapPage &$page) { $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL, $url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); // Fail on errors curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable curl_setopt($ch, CURLOPT_PORT, $_SERVER['SERVER_PORT']); //Set the port number curl_setopt($ch, CURLOPT_TIMEOUT, 15); // times out after 15s curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'); $return_value = curl_exec($ch); if ($return_value === false) { $info = curl_getinfo($ch); $page->setHttpCode($info['http_code']); $page->setContent(null); } else { $info = curl_getinfo($ch); $page->setHttpCode($info['http_code']); $page->setContent($return_value); } curl_close($ch); return $return_value; }