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 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line