I am trying to add some PHP includes files into Drupal 7 site. The files are on this page - https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/connecting_to_the_api_using_php.htm under the "Required PHP Includes" heading. It looks like I need these files: soap-wsse.php, exacttarget_soap_client.php, xmlseclibs.php in my Drupal install.

I will need to use the require('exacttarget_soap_client.php') function in a Drupal custom module.

My question is where to place these files in the file structure of Drupal and what would be the $type using drupal_get_path() function? Should I be using the Libraries API instead?

1 Answer 1


drupal_get_path() returns the path of a module, a theme, a theme engine, or a profile. It's not for loading a generic PHP file, for which you need module_load_include() which (despite the name) can be used for a PHP file that can be loaded with require_once.

Supposing you add the soap-wsse.php file in the includes directory of the test_module module, you cal load that file using the following code.

module_load_include('php', 'test_module', 'includes/soap-wsse');
  • Thank you. I have added the file to the code. I have added the following: ` $path = module_load_include('php', 'mc_forms', 'includes/exacttargetsoap/exacttarget_soap_client'); require($path . 'exacttarget_soap_client.php');`
    – Quaser8000
    Mar 18, 2019 at 13:06
  • Do I need to include path in require() function? The path for the module I am referencing is in the following folders: sites > all > modules > custom > mc_forms. Do I just add 'mc_forms' or 'custom/mc_forms' ? Thanks.
    – Quaser8000
    Mar 18, 2019 at 13:16
  • I am currently getting the error - ParseError: syntax error, unexpected 'CloudSoapClient' (T_STRING) in module_load_include() . Is this am issue with the require() function?
    – Quaser8000
    Mar 18, 2019 at 13:27
  • module_load_include() loads the file. You don't need to use the value returned from the function, nor use require. module_load_include() just needs the name of the module, not the directory containing it. Drupal will find where the module is installed, if it's installed.
    – apaderno
    Mar 18, 2019 at 14:32
  • Are you using PHP 5.2.3 or higher?
    – apaderno
    Mar 18, 2019 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.