dongye8110 2014-11-14 09:45
浏览 13

PHP覆盖其他服务器上的文件

I have a file called updateServer.php that has the following code:

$myfile = fopen("http://173.XXX.XXX.XXX/myurl/demo/path.txt", "w") or die("Unable to open file!");

I want to use this file to edit the path.txt file that is placed on another server. Is this really possible as I am unable to do this.

I took help from this : http://php.net/manual/en/features.remote-files.php

PS : I over-writted the files on the same server and was successful in the same.

  • 写回答

1条回答 默认 最新

  • duanhuihui2705 2014-11-14 09:47
    关注

    You can't write to URLs with fopen. It only makes GET requests.

    You could use the cURL library to make an HTTP PUT request, but you would have to configure the server you are writing to to support PUT requests in that fashion. (Web servers do not by default because it would be insane for any HTTP client to be able to write files to any server).

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据