1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 05:37:32 +02:00

Closes #4941 - Support for cURL POST, PUT, JSON.

This commit is contained in:
Cameron
2023-01-04 09:31:58 -08:00
parent 3bdb545b07
commit fe8fb34cb4

View File

@@ -586,9 +586,10 @@ class e_file
/**
* @param string $address
* @param array|null $options
*
* @return CurlHandle|false
*/
function initCurl($address, $options = null)
public function initCurl($address, $options = null)
{
$cu = curl_init();
@@ -638,6 +639,16 @@ class e_file
curl_setopt($cu, CURLOPT_POSTFIELDS, $options['post']);
}
if(!empty($options['postfields']))
{
curl_setopt($cu, CURLOPT_POSTFIELDS, $options['postfields']);
}
if(!empty($options['customrequest'])) // ie. GET, PUT, POST
{
curl_setopt($cu, CURLOPT_CUSTOMREQUEST, $options['customrequest']);
}
if(isset($options['header']) && is_array($options['header']))
{
curl_setopt($cu, CURLOPT_HTTPHEADER, $options['header']);
@@ -665,7 +676,7 @@ class e_file
* @param array $options [optional]
* @return string
*/
function getRemoteContent($address, $options = array())
public function getRemoteContent($address, $options = array())
{
// Could do something like: if ($timeout <= 0) $timeout = $pref['get_remote_timeout']; here