Integrations and APIs for Service

Get Involved. Join the Conversation.


    john sheflin
    can't open csv file to import - fopen can't open...
    Topic posted December 26, 2012 by john sheflinBronze Medal: 1,250+ Points 
    1049 Views, 5 Comments
    can't open csv file to import - fopen can't open file



    All the prior examples I can find on don't seem to be working for me.

    I am trying this:

    $fp = fopen('/euf/assets/uploads/testinsert.csv','r') or die("can't open file");

    I have tried a echo getcwd(); and used that directory location, but no love.

    I've tried putting the file in pages, in controllers, in assets/whatever

    I tried HTMLROOT . "

    No love.

    I found a reference to allow_fopen_url setting in a previous discussion topic, but I can't find reference to that anywhere either.

    Please assist.




    • Ryan McCullough


      What are you trying to do? It looks like you are trying to perform an import from CP. This is not what CP was designed for. I would not recommend it. Even if you were able to get the fopen command working, there are time & memory limits imposed on CP requests that would be difficult for you to investigate.

      Is there a reason you can't use the Data Import Wizard in the agent console?

    • john sheflin



      Yes, I am trying to import data into custom object. 

      I have to do two different updates every day, so I want to make the import automatic.

      I am open to any suggestions.

      thanks for responding


    • Ryan McCullough

      John, the best method of integrating with RightNow is to use the Connect Web Services for SOAP API. Would it be possible for you to use this API to push the data to RightNow?

      If that is not possible, you could engage RightNow Professional Services to build a custom scheduled import. You would be provided with a WebDAV location (separate from the Customer Portal WebDAV) to place your import files, and the scheduled job would retrieve them and process them.

      I also want to note that any files placed in the /euf/assets directory are publicly accessible. Placing import data there is extremely dangerous.

      I also want to note that Customer Care likely would not support an import script written in the CP framework. I would also investigate if this violates your user agreement.

    • john sheflin

      Wow, ok.  Again, thanks for the response.

      So I can't open a file anywhere on the server with fopen?  Where would be the safest place (which I can access) for a file?

      Last time I checked, I can't use curl with https, or I'd put it on a different server.  But maybe that's against the rules as well.

      My company is small and time and money are tight, so since my limited experience is php, I wanted to set up this import script in php. 

      I wasn't sure about where I could put a file that wouldn't be publicly acccessible, but I wanted to experiment to see if I could open a file from controllers.

      I didn't expect Customer Care to support anything I did.

      So it may be against the rules to curl data in, for example, and import data into a CO?

      I haven't explored Connect Web Services for SOAP API.  Perhaps you could provide a link specifically pointing to import csv into right now, or as close to that topic as possible?

      As I said, time and money are tight, and I already know how to do what I want to do with php script-wise, but rules are rules.

    • Ryan McCullough


      The file I/O functions will work, but you would need to know our internal file structure. This is not something we will publish or recommend as it is not guaranteed to be congruent from release to release.

      Off the top of my head, I can't think of any directory you can write to that is not exposed via a URL.

      What is preventing you from writing a PHP script that lives on a machine you control? This script could use our public SOAP API to perform the import tasks you are seeking. There is a menu at the top of this page for "Developers". Under that menu is a link to "Documentation & Sample Code". That will take you to a page with documentation for all of Oracle RightNow's public APIs. You will want to look at the "Connect Web Services For SOAP" API. The API documentation provides sample code (in Java and C#), as well as some sample XML requests.

      This may be your most cost effective method of performing this import.


      I suppose you could also create a custom CP controller to perform these imports using CPHP, and then have your PHP script (living on your machine) hit that controller. The down-sides to this are that each request to the controller will likely be treated as a unique CP session, which may incur additional charges. You also will likely run into size limitations if you were to attempt to send batches of records to the controller in a single request. The controller can likely handle mutiple, but there will be a ceiling at some point.