How to access internet link from within publication? - SOLVED

I’m testing a publication that is supposed to connect to the internet to download and display some data.

For example: http://ip-api.com/json gets you geolocation information.

But when I try to access any url (I tried file_get_contents and cURL), both are rejected with error “403 Forbidden”.

Is there a special way in ExeOutput to access the internet?

It seems the problem was related to a missing or invalid User Agent.

It can be configured in php.ini (In ExeOutput for PHP 1.7 -> PHP Settings tab -> PHP.ini)
Example: user_agent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0)"
or
using cURL
Example: curl_setopt($ch, CURLOPT_USERAGENT, ‘Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0’);