In Joomla, we have a Http package to send HTTP request, including CURL. But this class cannot customize some options we want, so we can using CurlHelper to handle our customize request.

Original Joomla Http Object

// Create an instance of a default JHttp object.
$http = new JHttp;

$options = new JRegistry;

$transport = new JHttpTransportStream($options);

// Create a 'stream' transport.
$http = new JHttp($options, $transport);

Or using JHttpFactory

// Create an instance of a default JHttp object.
$http = JHttpFactory::getHttp();

// Invoke the HEAD request.
$response = $http->head('');

// Prepare the data.
$data = array('make' => 'Holden', model => 'EJ-Special');

// Invoke the POST request.
$response = $http->post('', $data);

// Invoke the PUT request.
$response = $http->put('', $data);

// Invoke the DELETE request.
$response = $http->delete('');

Respond object


The response code is included in the "code" property. See


The response headers are included as an associative array in the "headers" property.


The body of the response (not applicable for the HEAD method) is included in the "body" property.



$url = 'http://tw,';

$respond = \Windwalker\Helper\CurlHelper::get($url);

echo $respond->body;

Post Page

$query = array(
    'foo' => 'bar'

$respond = \Windwalker\Helper\CurlHelper::get($url, 'post', $query);

echo $respond->body;

Customize Options

$option = array(
    CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64)",
    CURLOPT_FOLLOWLOCATION => !ini_get('open_basedir') ? true : false

$respond = \Windwalker\Helper\CurlHelper::get($url, 'get', $option);

echo $respond->body;

Download File

$url = '';

$dest = JPATH_ROOT . '/files/newFile.pdf';

$option = array();

\Windwalker\Helper\CurlHelper::download($url, $dest, $option);

Found a typo? Help us improve this document.

This document is for Windwalker Joomla RAD, if you are finding Windwalker PHP framework, please see: Windwalker Framework