douba9776 2017-09-23 03:35
浏览 33

如何从我的网站上获取我的计算机上的文件内容?

I want to get the contents of a file on my computer from my website , But not uploading it to that website and then get the contents because the file contents changes dynamically , I tried to turn the folder that contains that file to a URL so the URl whould be something like that : http://127.0.0.1:port or http://myIpAddress:port ,

and tried to use both file_get_contents() and cURL but I got errors and they are not working ,
I allowed xmlHTTPrequest to the directory but still can't use it .

Some of the errors:

when using 127.0.0.1:port :
1- file_get_contents(): failed to open stream: Connection refused
2- curl faild to connect to 127.0.0.1

when using my ip then the port:
1- file_get_contents no route to host
2- curl bool(false)

So is there is another way to get contents from a file from my website ?

  • 写回答

1条回答 默认 最新

  • dongwu1410 2017-09-23 03:43
    关注

    In your server CD to directory you want to serve, then

    python3 -m http.server
    

    By default it runs http server on 8000 port but you can specify custom port in argument

    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?