public static function load($url, $useSession = false)
    {
        $returnValue = (string) '';

        
        
        if(!empty($url)){
	        if($useSession){
	   			session_write_close();
	        }
			
	        $curlHandler = curl_init();
			
	        //if there is an http auth, it's mandatory to connect with curl
			if(USE_HTTP_AUTH){
				curl_setopt($curlHandler, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	            curl_setopt($curlHandler, CURLOPT_USERPWD, USE_HTTP_USER.":".USE_HTTP_PASS);
			}
			curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, 1);
			
			//to keep the session
	        if($useSession){
				if(!preg_match("/&$/", $url)){
					$url .= '&';
				}
				$url .= 'session_id=' . session_id();
				curl_setopt($curlHandler, CURLOPT_COOKIE, session_name(). '=' . $_COOKIE[session_name()] . '; path=/'); 
	        }
	        
			curl_setopt($curlHandler, CURLOPT_URL, $url);
				
			$returnValue = curl_exec($curlHandler);
			if(curl_errno($curlHandler) > 0){
				throw new Exception("Request error ".curl_errno($curlHandler).": ".  curl_error($curlHandler));
			}
			curl_close($curlHandler);  
        }
        
        

        return (string) $returnValue;
    }
public static function load($url, $useSession = false)
    {
        $returnValue = (string) '';

        
        
        if(!empty($url)){
	        if($useSession){
	   			session_write_close();
	        }
			
	        $curlHandler = curl_init();
			
	        //if there is an http auth, it's mandatory to connect with curl
			if(USE_HTTP_AUTH){
				curl_setopt($curlHandler, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	            curl_setopt($curlHandler, CURLOPT_USERPWD, USE_HTTP_USER.":".USE_HTTP_PASS);
			}
			curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, 1);
			
			//to keep the session
	        if($useSession){
				if(!preg_match("/&$/", $url)){
					$url .= '&';
				}
				$url .= 'session_id=' . session_id();
				curl_setopt($curlHandler, CURLOPT_COOKIE, session_name(). '=' . $_COOKIE[session_name()] . '; path=/'); 
	        }
	        
			curl_setopt($curlHandler, CURLOPT_URL, $url);
				
			$returnValue = curl_exec($curlHandler);
			if(curl_errno($curlHandler) > 0){
				throw new Exception("Request error ".curl_errno($curlHandler).": ".  curl_error($curlHandler));
			}
			curl_close($curlHandler);  
        }
        
        

        return (string) $returnValue;
    }
public static function load ( $ url , $ useSession = false ) { $ returnValue = ( string ) '' ; if ( ! empty ( $ url ) ) { if ( $ useSession ) { session_write_close ( ) ; } $ curlHandler = curl_init ( ) ; //if there is an http auth, it's mandatory to connect with curl if ( USE_HTTP_AUTH ) { curl_setopt ( $ curlHandler , CURLOPT_HTTPAUTH , CURLAUTH_BASIC ) ; curl_setopt ( $ curlHandler , CURLOPT_USERPWD , USE_HTTP_USER . ":" . USE_HTTP_PASS ) ; } curl_setopt ( $ curlHandler , CURLOPT_RETURNTRANSFER , 1 ) ; //to keep the session if ( $ useSession ) { if ( ! preg_match ( "/&$/" , $ url ) ) { $ url .= '&' ; } $ url .= 'session_id=' . session_id ( ) ; curl_setopt ( $ curlHandler , CURLOPT_COOKIE , session_name ( ) . '=' . $ _COOKIE [ session_name ( ) ] . '; path=/' ) ; } curl_setopt ( $ curlHandler , CURLOPT_URL , $ url ) ; $ returnValue = curl_exec ( $ curlHandler ) ; if ( curl_errno ( $ curlHandler ) > 0 ) { throw new Exception ( "Request error " . curl_errno ( $ curlHandler ) . ": " . curl_error ( $ curlHandler ) ) ; } curl_close ( $ curlHandler ) ; } return ( string ) $ returnValue ; }
Perform an HTTP Request on the defined url and return the content

@access public
@author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
@param  string url
@param  boolean useSession if you want to use the same session in the remotre server
@return string
@throws Exception
Perform an HTTP Request on the defined url and return the content