Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    rsurujbhLinksys
    Hosting Connect-PHP code inside custom scripts dir
    Topic posted July 4, 2012 by rsurujbhLinksys Red Ribbon: 250+ Points 
    1879 Views, 7 Comments
    Title:
    Hosting Connect-PHP code inside custom scripts dir
    Content:

    Instead of Customer Portal, is it possible to host and execute Connect for PHP code in the "custom scripts" directory (accessible inside CX for those with File Manager licensing) for usage within the agent desktop Incident workspaces / browser controls?

    i.e  http://interface.custhelp.com/cgi-bin/interface.cfg/php/custom/script.php

    Version:
    Feb 2011 SP2

    Comment

     

    • Pathaksa Tongpitak

      Hi,

      That is absolutely possible.

      All you have to do is include the header from http://interface.custhelp.com/cgi-bin/interface.cfg/php/mail/topmail.phph

      The last line of the header is something like this:

      list ($common_mbid, $rnw_mbid) = msg_init($p_cfgdir, 'msgbase', array('common', 'rnw'));

      And after that you write the following:
      use RightNow\Connect\v1_1 as RNCPHP;
      require_once( get_cfg_var("doc_root")."/ConnectPHP/Connect_init.php" );

       

      Good luck!

    • Allan Schrum

      A minor correction for sites that are 11.5 or later: please

      require_once( get_cfg_var("doc_root")."/include/ConnectPHP/Connect_init.phph" );

      instead. The other location is in the "wrong" spot and so we deprecated it and put the include file into the correct spot. The "wrong" file will be removed when we release 13.5 (May 2013) so please use the official location so that you will not be surprised in the future.

      For 10.11 and 11.2 the "wrong" location is the official location. Please be aware that you may need to change your scripts the next time you upgrade.

      Regards,

      -Allan

    • rsurujbhLinksys

      Thanks guys. It got it working! The path to Connect_init.phph was the problem.

      Allan,

      1. require_once( get_cfg_var("doc_root")."/include/ConnectPHP/Connect_init.phph" );

      2. require_once( get_cfg_var("doc_root")."/ConnectPHP/Connect_init.php" );

      On our site, when I use the path in #1, our code is throwing fatal errors ("failed to open stream: No such file or directory").

      When I use #2, it works!

      Is that normal on an Feb 2011 (11.2) site?

    • Allan Schrum

      I think so for 11.2. I believe we fixed this in 11.5 (which is why we are removing it in 13.5 - two years later). I missed that you are on 11.2, so your "official" file is the one you found to work. I guess you can keep this in mind for the next time you upgrade that this might need changing.

      Glad you got it working! I'm editing my remarks above to indicate this is for 11.5 and later.

      Regards,

      -Allan

    • Magiva

      Im led to believe that this will incur a session charge because of using the customer portal url

      is there another way to reference the custom folder and custom script ?

    • Barrilito van Dijk

      Hi Magiva,

      The comment you gave is on a discussion of four years ago. Could you please post your question in a seperate new thread. Thanks!

      Regards!

    • Dietrik

      An alternative is to create an addin.