Fileman fileop function
Hello,
i uploaded a ZIP, and i need to extract it.
Here is my code.
[PHP]
'extract',
'sourcesfiles' => 'public_html/damn/app.zip',
'doubledecode' => '0'
);
// Set up the cURL request object.
$ch = curl_init( $request_uri );
curl_setopt( $ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt( $ch, CURLOPT_USERPWD, $username . ':' . $password );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
// Set up a POST request with the payload.
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
// Make the call, and then terminate the cURL caller object.
$curl_response = curl_exec( $ch );
curl_close( $ch );
// Decode and validate output.
$response = json_decode( $curl_response );
if( empty( $response ) ) {
echo "The cURL call did not return valid JSON:\n";
die( $response );
} elseif ( !$response->status ) {
echo "The cURL call returned valid JSON, but reported errors:\n";
die( $response->errors[0] . "\n" );
}
// Print and exit.
die( print_r( $response ) );
?>
[/PHP]
But i receive this error
[QUOTE]The cURL call returned valid JSON, but reported errors: The system could not find the function "fileop" in the module "Fileman".
This is a function, fileop right... ?
This is a function, fileop right... ?
-
May someone explain me this please ? I really don't know why we pay for license fee but have no support... 0 -
Hello @Visad182, It looks like you are attempting to use a session-based API call for a cPanel API 2 function: // Define the API call. $cpanel_host = 'localhost'; $request_uri = "https://$cpanel_host:2083/execute/Fileman/fileop";
That type of call isn't supported with cPanel API 2 the way that it is with cPanel UAPI. You can scroll to the bottom of the following document and click on the various API types to see the supported methods of calling functions: Guide to cPanel API 2 - Developer Documentation - cPanel Documentation Also, note that a good approach when troubleshooting an issue with an API function is to test it out via the command line first. Here's an example of how to use this cPanel API 2 function via the command line:# cpapi2 --user=username123 Fileman fileop op=extract sourcefiles=/home/username123/example.zip destfiles=/home/username123/ doubledecode=1 --- cpanelresult: apiversion: 2 data: - dest: /home/username123 output: "Archive: /home/username123/example.zip\n extracting: 123 \n extracting: 456 \n" result: 1 src: /home/username123/example.zip event: result: 1 func: fileop module: Fileman
This command correctly extracted the files from /home/username123/example.zip to the /home/username123/ directory. Keep in mind that opening a support ticket is a better approach if you require more immediate assistance (24/7 support is not offered on the cPanel Forums): Create Support Ticket - Version 72 Documentation - cPanel Documentation Thank you.0
Please sign in to leave a comment.
Comments
2 comments