cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 9
Report Inappropriate Content
Message 1 of 3

Error on system.importTag

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
2 Replies
Highlighted

Re: Error on system.importTag

I get the exact same error when using system.importTag, were you able to find a solution?

Highlighted

Re: Error on system.importTag

Try this line in your code:

curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array("uploadFile" =@c:\reports\test.xml ) ) ); // add POST fields

I had alot of issues with this one, my URL now looks like this:

https://servername:8443/remote/system.importTag -F uploadFile=@filepath

Its the "@" that does the trick.

Hope that helps.

Cheers

J

You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community