public function send($timeout=null) 
	{
		$format = $this->params->getString("format",null);

		if (!strrpos($this->method, ".")) {
			$this->host = "socialize.".$this->apiDomain;
			$this->path = "/socialize.".$this->method;
		} else {
			$tokens = explode( ".", $this->method );
			$this->host = $tokens[0].".".$this->apiDomain;
			$this->path = "/".$this->method;
		}
		
		//set json as default format.
		if (empty($format))
		{
			$format =  "json";
			$this->setParam("format", $format);
		}
		if(!empty($timeout))
		{
			$this->traceField("timeout",$timeout);
		}
		
		if (empty($this->method) || (empty($this->apiKey) and empty($this->userKey)) )
		{
			return new GSResponse($this->method,null,$this->params,400002,null,$this->traceLog);
		}
		
		if ($this->useHTTPS && empty(GSRequest::$cafile)) 
		{
			return new GSResponse($this->method,null,$this->params,400003,null,$this->traceLog);
		}

		try 
		{
			$this->setParam("httpStatusCodes", "false");
			
			$this->traceField("userKey", $this->userKey);
			$this->traceField("apiKey", $this->apiKey);
			$this->traceField("apiMethod", $this->method);
			$this->traceField("params",$this->params);
			$this->traceField("useHTTPS", $this->useHTTPS);

			$responseStr = $this->sendRequest("POST", $this->host, $this->path, $this->params, $this->apiKey, $this->secretKey, $this->useHTTPS,$timeout, $this->userKey);
			
			return new GSResponse($this->method,$responseStr,null,0,null,$this->traceLog);
		}
		catch (Exception $ex) {
			$errcode = 500000;
			$errMsg = $ex->getMessage();
		    $length = strlen("Operation timed out");
		    if((substr($ex->getMessage(), 0, $length) === "Operation timed out"))
			{
				 $errcode = 504002;
				 $errMsg = "Request Timeout";
			}
	
			return new GSResponse($this->method,null,$this->params,$errcode,$errMsg, $this->traceLog);
		}
	}
public function send($timeout=null) 
	{
		$format = $this->params->getString("format",null);

		if (!strrpos($this->method, ".")) {
			$this->host = "socialize.".$this->apiDomain;
			$this->path = "/socialize.".$this->method;
		} else {
			$tokens = explode( ".", $this->method );
			$this->host = $tokens[0].".".$this->apiDomain;
			$this->path = "/".$this->method;
		}
		
		//set json as default format.
		if (empty($format))
		{
			$format =  "json";
			$this->setParam("format", $format);
		}
		if(!empty($timeout))
		{
			$this->traceField("timeout",$timeout);
		}
		
		if (empty($this->method) || (empty($this->apiKey) and empty($this->userKey)) )
		{
			return new GSResponse($this->method,null,$this->params,400002,null,$this->traceLog);
		}
		
		if ($this->useHTTPS && empty(GSRequest::$cafile)) 
		{
			return new GSResponse($this->method,null,$this->params,400003,null,$this->traceLog);
		}

		try 
		{
			$this->setParam("httpStatusCodes", "false");
			
			$this->traceField("userKey", $this->userKey);
			$this->traceField("apiKey", $this->apiKey);
			$this->traceField("apiMethod", $this->method);
			$this->traceField("params",$this->params);
			$this->traceField("useHTTPS", $this->useHTTPS);

			$responseStr = $this->sendRequest("POST", $this->host, $this->path, $this->params, $this->apiKey, $this->secretKey, $this->useHTTPS,$timeout, $this->userKey);
			
			return new GSResponse($this->method,$responseStr,null,0,null,$this->traceLog);
		}
		catch (Exception $ex) {
			$errcode = 500000;
			$errMsg = $ex->getMessage();
		    $length = strlen("Operation timed out");
		    if((substr($ex->getMessage(), 0, $length) === "Operation timed out"))
			{
				 $errcode = 504002;
				 $errMsg = "Request Timeout";
			}
	
			return new GSResponse($this->method,null,$this->params,$errcode,$errMsg, $this->traceLog);
		}
	}
public function send ( $ timeout = null ) { $ format = $ this -> params -> getString ( "format" , null ) ; if ( ! strrpos ( $ this -> method , "." ) ) { $ this -> host = "socialize." . $ this -> apiDomain ; $ this -> path = "/socialize." . $ this -> method ; } else { $ tokens = explode ( "." , $ this -> method ) ; $ this -> host = $ tokens [ 0 ] . "." . $ this -> apiDomain ; $ this -> path = "/" . $ this -> method ; } //set json as default format. if ( empty ( $ format ) ) { $ format = "json" ; $ this -> setParam ( "format" , $ format ) ; } if ( ! empty ( $ timeout ) ) { $ this -> traceField ( "timeout" , $ timeout ) ; } if ( empty ( $ this -> method ) || ( empty ( $ this -> apiKey ) and empty ( $ this -> userKey ) ) ) { return new GSResponse ( $ this -> method , null , $ this -> params , 400002 , null , $ this -> traceLog ) ; } if ( $ this -> useHTTPS && empty ( GSRequest :: $ cafile ) ) { return new GSResponse ( $ this -> method , null , $ this -> params , 400003 , null , $ this -> traceLog ) ; } try { $ this -> setParam ( "httpStatusCodes" , "false" ) ; $ this -> traceField ( "userKey" , $ this -> userKey ) ; $ this -> traceField ( "apiKey" , $ this -> apiKey ) ; $ this -> traceField ( "apiMethod" , $ this -> method ) ; $ this -> traceField ( "params" , $ this -> params ) ; $ this -> traceField ( "useHTTPS" , $ this -> useHTTPS ) ; $ responseStr = $ this -> sendRequest ( "POST" , $ this -> host , $ this -> path , $ this -> params , $ this -> apiKey , $ this -> secretKey , $ this -> useHTTPS , $ timeout , $ this -> userKey ) ; return new GSResponse ( $ this -> method , $ responseStr , null , 0 , null , $ this -> traceLog ) ; } catch ( Exception $ ex ) { $ errcode = 500000 ; $ errMsg = $ ex -> getMessage ( ) ; $ length = strlen ( "Operation timed out" ) ; if ( ( substr ( $ ex -> getMessage ( ) , 0 , $ length ) === "Operation timed out" ) ) { $ errcode = 504002 ; $ errMsg = "Request Timeout" ; } return new GSResponse ( $ this -> method , null , $ this -> params , $ errcode , $ errMsg , $ this -> traceLog ) ; } }
Send the request synchronously
Send the request synchronously