public class Gateway

class.gateway.php #20

The Gateway class provides a standard way to interact with other pages. By default it is essentially a wrapper for CURL, but if that is not available it falls back to use sockets.

Constants

static string FORCE_SOCKET = 'socket'

Constant used to explicitly bypass CURL and use Sockets to complete the request.

Methods

string exec(string $force_connection_method)

Executes the request using Curl unless it is not available or this function has explicitly been told not by providing the Gateway::FORCE_SOCKET constant as a parameter. The function will apply all the options set using curl_setopt before executing the request. Information about the transfer is available using the getInfoLast() function. Should Curl not be available, this function will fallback to using Sockets with fsockopen

Parameters
  • $force_connection_method stringOnly one valid parameter, Gateway::FORCE_SOCKET

Returns

The result of the transfer as a string. If any errors occur during a socket request, false will be returned.

See Also
void flush()

Resets $this->_postfields variable to an empty string

array getInfoLast()

Returns some information about the last transfer, this the same output array as expected when calling the curl_getinfo() function. If Sockets were used to complete the request instead of CURL, the resulting array will be the HTTP Code, Content Type, URL and Total Time of the resulting request

See Also
void init(string $url)

Mimics curl_init in that a URL can be provided

Parameters
  • $url stringA full URL string to use for the request, this can include basic authentication which will automatically set the correct options for the CURL request. Defaults to null

static boolean isCurlAvailable()

Checks to the see if CURL is available, if it isn't, false will be returned, and sockets will be used

void setopt(string $opt, mixed $value)

A basic wrapper that simulates the curlsetopt function. Any options that are not recognised by Symphony will fallback to being added to the $custom_opt array. Any options in $custom_opt will be applied on executed using curlsetopt. Custom options are not available for Socket requests. The benefit of using this function is for convienience as it performs some basic preprocessing for some options such as 'URL', which will take a full formatted URL string and set any authentication or SSL curl options automatically

Parameters
  • $opt stringA string representing a CURL constant. Symphony will intercept the following, URL, POST, POSTFIELDS, USERAGENT, HTTPHEADER, RETURNHEADERS, CONTENTTYPE and TIMEOUT. Any other values will be saved in the $custom_opt array.

  • $value mixedThe value of the option, usually boolean or a string. Consult the setopt documentation for more information.

See Also

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details