开发者

Delete Remote file With @get_file_contents - PHP

开发者 https://www.devze.com 2023-02-09 01:21 出处:网络
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.

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 w开发者_如何学编程ith 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号