ultimix
http_1_0_0 Class Reference

Public Member Functions

 set ($FieldName, $FieldValue)
 http_request ($Data= '')
 https_request ($Data= '')
 fetch_request_header ($RequestData)
 fetch_request_body ($RequestData)

Data Fields

 $host = 'localhost'
 $url = '/'
 $type = 'POST'

Detailed Description

Simple utilities for http requests.

Author
Dodonov A.A.

Definition at line 26 of file http.php.

Member Function Documentation

fetch_request_body (   $RequestData)

Getting request body.

Parameters
$RequestData- Received data.
Returns
Request body.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 287 of file http.php.

{
try
{
$RequestParts = explode( "\r\n\r\n" , $RequestData );
$Start = strpos( $RequestParts[ 1 ] , "\r\n" );
return( substr( $RequestParts[ 1 ] , $Start + 2 ) );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
fetch_request_header (   $RequestData)

Getting headers.

Parameters
$RequestData- Received data.
Returns
Header.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 251 of file http.php.

{
try
{
$RequestParts = explode( "\r\n\r\n" , $RequestData );
return( $RequestParts[ 0 ] );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
http_request (   $Data = '')

Sending requests.

Parameters
$Data- Data to send.
Returns
Server responce.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 157 of file http.php.

{
try
{
$Curl = $this->default_init( $Data );
$RequestData = curl_exec( $Curl );
if( curl_errno( $Curl ) )
{
throw( new Exception( curl_error( $Curl ) ) );
}
curl_close( $Curl );
return( $RequestData );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
https_request (   $Data = '')

Sending requests.

Parameters
$Data- Data to send.
Returns
Server responce.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 202 of file http.php.

{
try
{
$Curl = $this->default_init( $Data );
curl_setopt( $Curl , CURLOPT_SSLVERSION , 3 );
curl_setopt( $Curl , CURLOPT_SSL_VERIFYPEER , false );
curl_setopt( $Curl , CURLOPT_SSL_VERIFYHOST , 2 );
$RequestData = curl_exec( $Curl );
if( curl_errno( $Curl ) )
{
throw( new Exception( curl_error( $Curl ) ) );
}
curl_close( $Curl );
return( $RequestData );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
set (   $FieldName,
  $FieldValue 
)

Function sets field.

Parameters
$FieldName- Field name.
$FieldValue- Field value.
Author
Dodonov A.A.

Definition at line 46 of file http.php.

{
$this->$FieldName = $FieldValue;
}

Field Documentation

$host = 'localhost'

Host.

Author
Dodonov A.A.

Definition at line 61 of file http.php.

$type = 'POST'

Request type.

Author
Dodonov A.A.

Definition at line 85 of file http.php.

$url = '/'

URL.

Author
Dodonov A.A.

Definition at line 73 of file http.php.


The documentation for this class was generated from the following file: