发送文件到PHP脚本从VB.NET应用程序 [英] Send a file to a PHP script from a VB.NET app

查看:158
本文介绍了发送文件到PHP脚本从VB.NET应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要发送从SQL数据库服务器的一些数据的内部网络到外部Web服务器。

I need to send some data from a SQL DB Server on an internal network to an external web server.

我希望通过写这是每天发送约1 MB的数据到PHP脚本的Web服务器,它被存放在一个数据库中调用一次VB.NET应用程序来实现这一目标。

I was hoping to accomplish this by writing a VB.NET app that is invoked once per day that sends about 1 MB of data to a PHP script on the web server, where it is deposited in a database.

什么是将数据从一个.NET应用程序发送到PHP脚本的好方法?

What is a good method to send data to a PHP script from a .NET app?

推荐答案

您可以使用的 HttpWebRequest的类发布一个文件到您的PHP脚本就像将浏览器。如果要发送的文件是基于如XML或CSV文本,一个简单的后可以做。但是,如果你需要发送二进制数据,你既可以连接code它的base64和c它,然后去$ C $在PHP的另一端,或发布为一个文件,使用的multipart形式的。除非你有特殊原因要使用多表格,这可能是不值得所有的额外麻烦,你应该只连接code数据使用Base64。

You can use the HTTPWebRequest class to post a file to your php script just as a browser would. If the file you are sending is text based like XML or CSV, a simple post could be done. However, if you need to send binary data, you could either encode it base64 and then decode it on the other end in PHP, or post it as a file, using multipart forms. Unless you have a specific reason to be using multipart forms, it probably isn't worth all the extra trouble, and you should probably just encode your data with base64.

这篇关于发送文件到PHP脚本从VB.NET应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆