Skip to content

Using cURL extension

Activate cURL support in your apps

ExeOutput for PHP lets you access the cURL library thats ships with PHP to make requests to URLs using a variety of protocols such as HTTP, HTTPS, FTP...

In order to use cURL in your app, you must first configure ExeOutput for PHP to enable the cURL PHP extension. In ExeOutput for PHP, navigate to PHP Settings then PHP Extensions. Select php_curl.dll and right click on it. Choose Compile into the EXE into the context menu displayed.

cURL enable extension

After that, cURL functions are accessible.

Tip

Please refer to the cURL topic of the General Demonstration for a working cURL demo with HTTPS support.

Note

The cURL extension requires additional dependencies (such as libeay32.dll, libssh2.dll, ssleay32.dll, nghttp2.dll). ExeOutput for PHP will automatically compile these dependencies into the EXE if you choose "Compile into the EXE" for cURL. On the contrary, if you choose "Copy ... outside the EXE", the DLLs will be copied to the same folder as your EXE file.

Accessing secure websites with HTTPS

Without correct configuration, if you try to access an HTTPS (SSL or TLS-protected resource) in PHP using cURL, you are likely to fail.

The proper way is to include the cacert.pem file within your app. cacert.pem is a bundle of CA certificates that cURL uses to verify that a remote server is really behind the website you want to work with.

You can download up-to-date cacert.pem versions here.

Then, in your ExeOutput for PHP project, place the cacert.pem in the Source folder of your app, for instance the root folder (Application Root in File Manager).

Finally, provide cURL with the full path to cacert.pem file by using this PHP code:

<?php
...
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "\cacert.pem");
...
?>

This code supposes that you placed the cacert.pem in the same folder as the PHP file.

Tip

Please refer to the cURL topic of the General Demonstration for a working cURL demo with HTTPS support.

See also: PHP Extensions