Hawk - PHP documentation
  • Namespace
  • Class
  • Tree

Namespaces

  • Hawk
    • View
      • Plugins

Classes

  • App
  • ButtonInput
  • Cache
  • CheckboxInput
  • ColorInput
  • Conf
  • Controller
  • Crypto
  • DatabaseSessionHandler
  • DatetimeInput
  • DB
  • DBExample
  • DeleteInput
  • Dialogbox
  • EmailInput
  • ErrorHandler
  • Event
  • FileInput
  • FileSystem
  • FloatInput
  • Form
  • FormFieldset
  • FormInput
  • GenericModel
  • GifImage
  • HawkApi
  • HawkUpdater
  • HiddenInput
  • HtmlInput
  • HTTPRequest
  • Icon
  • Image
  • IntegerInput
  • ItemList
  • ItemListField
  • JpegImage
  • Lang
  • Language
  • LeftSidebarTab
  • Less
  • Logger
  • Mail
  • MenuItem
  • Model
  • NoSidebarTab
  • NumberInput
  • ObjectInput
  • Option
  • Panel
  • PasswordInput
  • Permission
  • Plugin
  • PluginInstaller
  • PngImage
  • ProfileQuestion
  • ProfileQuestionValue
  • RadioInput
  • Request
  • Response
  • RightSidebarTab
  • Role
  • RolePermission
  • Route
  • Router
  • SelectInput
  • Session
  • Singleton
  • SubmitInput
  • Tabs
  • TextareaInput
  • TextInput
  • Theme
  • TimeInput
  • Upload
  • User
  • View
  • ViewPlugin
  • Widget
  • WysiwygInput

Traits

  • Utils

Exceptions

  • AppStopException
  • DBExampleException
  • DBException
  • FileSystemException
  • HawkApiException
  • ImageException
  • MailException
  • UploadException
  • ViewException

Class HTTPRequest

This class is used to send HTTP request and get the result

Hawk\HTTPRequest uses Hawk\Utils
Namespace: Hawk
Package: Network
Located at HTTPRequest.php

Methods summary

public
# __construct( array $options )

Create a HTTP request

Create a HTTP request

Parameters

$options

The request parameters. This array can have the following data : - 'url' (required): The url to call - 'method' (optionnal, default 'GET') : The HTTP method - 'body' (optionnal) : The request content - 'files' (optionnal) : The files to upload (the filenames) - 'headers' (optionnal) : The request headers - 'dataType' (optionnal, default 'html') : The wanted response type - 'contentType' (optionnal) : The request content type

public
# setHeaders( array $headers )

Set further headers

Set further headers

Parameters

$headers
The headers to add
public
# setBody( mixed $body )

Set the request body

Set the request body

Parameters

$body
The body to set
public
# setFiles( array $files )

Set the files to upload

Set the files to upload

Parameters

$files
The list of filenames to upload
public
# setDataType( string $type )

Set the expected data type

Set the expected data type

Parameters

$type
The expected type of response data. Can be 'text', 'html', 'json', 'xml' or the wanted mime type
public
# setContentType( string $type )

Set the request Content type

Set the request Content type

Parameters

$type
The expected type of response data. Can be 'text', 'html', 'json', 'xml' or the wanted mime type
public
# send( )

Send the request and get the result

Send the request and get the result

public mixed
# getResponseHeaders( string $name = null )

Get the response headers. If $name is set, then this function will return the specific header value, else it will return an array containing all headers

Get the response headers. If $name is set, then this function will return the specific header value, else it will return an array containing all headers

Parameters

$name
The name of a specific

Returns

mixed
The array containing all headers, or the value of the headers specified by $name
public integer
# getStatusCode( )

Get the response status Code

Get the response status Code

Returns

integer
the value of the response status code
public mixed
# getResponse( )

Get the response body

Get the response body

Returns

mixed
The HTTP response body, formatted following the dataType requested

Methods used from Hawk\Utils

debug(), getSerializedVersion(), map()

Constants summary

string METHOD_POST
# 'POST'
string METHOD_GET
# 'GET'
string METHOD_PUT
# 'PUT'
string METHOD_DELETE
# 'DELETE'
string METHOD_PATCH
# 'PATCH'
Hawk - PHP documentation API documentation generated by ApiGen