Panama Jack
Panama Jack

Reputation: 24468

Delete Remote file With @get_file_contents - PHP

I have been trying to delete images from a remote server. I don't want to use a direct link because the server changes depending on the location of the file. I have code like this.

$photo["server"] = "http://img1.myserver.com";
$call = @file_get_contents( $photo["server"]."/delete.php?pho_id=".$pho_id."&pag_id=".$pag_id );

Is there some reason why this wont work? I send the vars and grab them in the php file. It works fine with a direct browser call but I want to do it from the script. Any ideas why this wont execute the script? And fopen is enabled on my server.

Upvotes: 0

Views: 887

Answers (1)

alex
alex

Reputation: 490423

You need to make sure allow_fopen_url is on.

What happens when you echo the string? Is it as expected?

What happens when you remove the error suppressor operator (which is bad practice)?

Is the other site yours? Why doesn't it use POST for state changing actions?

There may be cookies in play. Check what cookies the browser has stored when you do it in direct browser call.

Upvotes: 2

Related Questions