Skip to content

Commit

Permalink
Fix curl params
Browse files Browse the repository at this point in the history
  • Loading branch information
dasistwas committed Oct 26, 2023
1 parent ff9d124 commit 8e5e2bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rule/ftpsyncfiles/rule_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,10 @@ private function download_files(int $did): void {
);
echo "Downloaded $filename successfully." . PHP_EOL;
// Delete the file from the remote server using cURL.
$deletech = curl_init();
curl_setopt($deletech, CURLOPT_URL, $remotepath);
curl_setopt($deletech, CURLOPT_QUOTE, array("rm ".escapeshellarg("$remotepath"));
$deleteresult = curl_exec($deletech);
curl_close($deletech);
curl_setopt($filehandle, CURLOPT_URL, $remotepath);
curl_setopt($filehandle, CURLOPT_QUOTE, ["delete ".escapeshellarg($remotepath)]);
$deleteresult = curl_exec($filehandle);
var_dump(curl_errno($filehandle),curl_error($filehandle));
if ($deleteresult === false) {
echo "Failed to delete $filename on the remote server." . PHP_EOL;
} else {
Expand All @@ -219,6 +218,7 @@ private function download_files(int $did): void {
} else {
echo "Failed to download $filename." . PHP_EOL;
}
echo json_encode(curl_getinfo($filehandle));
curl_close($filehandle);
}
}
Expand Down

0 comments on commit 8e5e2bf

Please sign in to comment.