doulu8341 2014-12-16 19:24
浏览 16
已采纳

卷曲 - 同样的动作,不同的结果?

I'd be much appreciative if someone could explain to me how curl is getting two different results from what I feel should be similar commands.

I have a php script which returns a daily extract upon accessing a semi-public (open but not indexed) URL. We've started collecting more sensitive information and need it secured.

I've been successfully collecting the information via Curl thusly:

curl -o C:\localdirectory\extract.csv http://foo.bar/daily_data_extract.php

I have access to the site assets of course, via SFTP and I figured the commmand would work like this:

curl -o C:\localdirectory\extract.csv sftp://user:pass@foo.bar/blah/htdocs/daily_data_extract.php -k

But this doesn't seem to work. I'm just getting the PHP code downloaded as a CSV and not the results I need. I'm new to Curl and previously just used wget (which doesn't support SFTP to my understanding).

I'd appreciate the pointers on what I'm missing!

  • 写回答

1条回答 默认 最新

  • drj26159 2014-12-16 20:03
    关注

    PHP must be executed by the web server, for example Apache. When you visit a PHP file via HTTP, you are seeing the result of that script being executed. If you retrieve the file directly, you are getting the raw script instead.

    If you need to access the result of the script securely, your web server could be set up with HTTPS... however, this only protects against eavesdropping, and the URL would still be publicly accessible. Alternatively, you could modify the script and have it direct output to a file, which you can then download via SFTP.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了