Omitir navegación
Ampliar
Use of load_curl() function in multiple scripts
ID de respuesta 10789   |   Revisado 18/05/2020

Why is my load_curl() function failing when being used concurrently in several scripts?

Environment

Oracle B2C Service

All supported versions

Resolution

As described in the general Connect PHP API documentation, curl can be used to enable external integrations using the Custom Processes functionality available with Oracle B2C Service.

In order to achieve this, the code needs to load the curl libraries available with Oracle B2C Service starting with August 2013 release, by making use of the sample code below:

==============================

load_curl();
$curl = curl_init();

static::$url_used = $url;

curl_setopt_array($curl,array(
CURLOPT_URL => $url,
CURLOPT_HEADER => 0,
CURLOPT_HTTPHEADER => $header,
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_CONNECTTIMEOUT => 20,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0
));
$content = curl_exec($curl);

==============================

When the curl libraries are used/called concurrently in multiple scripts, we need to ensure that the following check is performed before loading the libraries, to prevent any code failures:

if(!extension_loaded('curl')) { load_curl(); }

 

Para obtener información adicional, consulte la sección Custom Process Overview en la documentación en línea para la versión que su sitio está ejecutando actualmente. Para acceder a los manuales y la documentación en línea de Oracle B2C Service, consulte la Documentación de los productos de Oracle B2C Service.

Notificarme
La página se refrescará al enviar. Las entradas pendientes se perderán.