General Technical Discussions for Service

Get Involved. Join the Conversation.

Topic

    Kevin Browne
    Problem loading CURL library in a Custom Script on May 2014Answered
    Topic posted October 3, 2014 by Kevin BrowneGreen Ribbon: 100+ Points 
    985 Views, 6 Comments
    Title:
    Problem loading CURL library in a Custom Script on May 2014
    Content:

    Hello,

    I suppose I'll be the first to post in the new General Developer Discussions area so here goes..  I'm working on a May 2014 site and am building an integration with a SOAP web service.  This will be a Custom Script that will eventually be configured as a cron job.  Since I need to make SOAP requests, I am trying to load the CURL library to facilitate this.  According to this KB Answer:

    https://cx.rightnow.com/app/answers/detail/a_id/5433/kw/curl

    I should be able to load the CURL library with:

    dl('curl_php5.so');

    However, it's not working on this site.  It appears the "dl" function is now blacklisted in Custom Scripts as I'm getting the following error:

    Fatal error: Access to dl is denied in /cgi-bin/interface.cfg/scripts/custom/integration_test.php on line 11

    Can someone confirm that this is the case on a May 2014 site and if so the procedure to get this function whitelisted?  I'm assuming this will require the customer make a request to Customer Care to have this done?

    Any help would be greatly appreciated.

    Thanks,

    KB

     

    Best Comment

    Seeking Solution

    To make load_curl() function work in custom folder you need to include init file in before you use load_curl function. Generally this init file is kept in start of the file. After adding this load_curl function should work:

    $ip_dbreq = true;
    require_once('include/init.phph');

     

    Comment

     

    • Richard Morgan

      I'll ask the stupid question first: which CP version are you on?  Your linked answer says CP 3 needs to call load_curl().



      This question seems related.

    • Kevin Browne

      Hi Richard,

      Thanks for the reply, I actually did run across that post.  My customization is for a Custom Script uploaded using the file manager in the console, in the /scripts/custom directory.  So it's actually totally outside and independent of the Customer Portal framework.  The /scripts/custom directory has been in the product for many years and is typically where one-off PHP scripts go, such as scripts for data imports or, in my case, a CRON job.

      I've tried using the dl() function to load the CURL library which has worked many times in the past.  And I did try the load_curl() function inside the Custom Script, but unfortunately this appears to be only available within the Customer Portal framework. sad

       
    • Seeking Solution

      To make load_curl() function work in custom folder you need to include init file in before you use load_curl function. Generally this init file is kept in start of the file. After adding this load_curl function should work:

      $ip_dbreq = true;
      require_once('include/init.phph');

       

    • Kevin Browne

      Thanks Seeking Solution, that appears to have worked.  Much appreciated!

    • Barrilito van Dijk

      A minor addition:

      In the post referenced in the previous comments, it states that the load_curl() is for CP3. But it turns out that this is also needed in some CP2 version to make it work!

       

      Regards!

    • Swati Jain Gururani

      I am having the same problem in CPM. Getting the below error 

      Call to undefined function RightNow\CPMObjectEventHandlers\<CPM name>\curl_init()
       

      Can you please tell where is the ('include/init.phph') folder that needs to be included in code.