2 Replies Latest reply on Oct 22, 2013 9:53 AM by jonathanhaughey

    Error on system.importTag

    Erik

      I am trying to build a PHP script that at one point creates a new tag in ePO. This requires the system.importTag function which requires an .xml file containing the tags to be imported.

      In terms of cURL i have simply copied the code from the example web interface in this forum, which happens to be in php as well. This is basically what i came up with so far:

       

      // The url variable is the get command passed to ePO
      $url = "https://localhost:8443/remote/importTag"; 
      $ch = curl_init(); // initialize curl handle 
      curl_setopt($ch, CURLOPT_URL,$url); // set url to post to 
      
      // The next line passes epo credentials for authentication to epo server
      curl_setopt($ch, CURLOPT_USERPWD, "username:password" );
      curl_setopt($ch, CURLOPT_FAILONERROR, 1); 
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects 
      curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable 
      curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s 
      curl_setopt($ch, CURLOPT_POST, TRUE); // set POST method 
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this avoids failures if cert is not valid
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array("uploadFile" => "c:\reports\test.xml" ) ) ); // add POST fields 
      
      $result = curl_exec($ch); // run the whole process 
      
      //Uncomment the next 3 lines for error analysis
      //print_r(curl_getinfo($ch));  
      //echo "\n\ncURL error number:" .curl_errno($ch);  
      //echo "\n\ncURL error:" . curl_error($ch);  
      curl_close($ch);  
      
      print_r( $result ); 
      

       

      However, this leads to the following error:

       

      Error 0 :

      unsupported format: java.lang.String

       

      Can't figure out what the problem is, tried removing the file path and only specifying filename. @filename. etc.etc

       

      Any ideas?

       

      Message was edited by: Erik on 5/17/13 11:05:44 PM CDT

       

      Message was edited by: Erik on 5/17/13 11:07:04 PM CDT