http-post

Sending file > 1MB using HTTP POST

这一生的挚爱 提交于 2019-12-01 07:26:29
问题 I'm sending video and audio files from my Android application to Wampserver , some of these can get quite large and I tend to get OutofMemory issues when the file is approximately over 1MB in size. I convert each file individually into a byte stream. I think the byte stream is too large hence the OutofMemory . How can I stop this error from occurring? 回答1: Using the link Maxium suggested here: Uploading files to HTTP server using POST on Android. I then found this Out of Memory error in

HTTP POST on Android

自闭症网瘾萝莉.ら 提交于 2019-12-01 07:10:22
问题 I want to make a simple HTTPRequest to a php script and I have tried to make the very most basic of apps to get the functionality working. I want to test that my app is sending the data I feed it so I've made the android app send to a server and that server is supposed to send me the data I've put into the app. The code for the "postData" function is to send data from android to the server and the code for the "default.php" is the recieving php file on a webserver which then forwards the data

Submit webform via URL only?

倖福魔咒の 提交于 2019-12-01 07:00:40
I'm not really sure this belongs here, so instead of downvoting just lemme know if so and I'll quickly move it on. Anyway, there is a website that has a search page, that when hitting the search button it doesn't include the search query in the URL. After searching for something, the page is redirected to ssearch.asp , but as said, the query isn't there. My question is if there is a way to submit the search values solely via URL. I was wondering if there is a way to fake the search-submit button and post the search term via URL according to form field names. The name of the input box is search

Why can't I send `None` as data in a POST request using Python's `requests` library?

喜你入骨 提交于 2019-12-01 06:54:32
It seems that when a key in data has a value of None , the key isn't included by requests. >>> req = requests.Request('POST', 'http://google.com', data=dict(a=None, b=1)) >>> req.prepare().body 'b=1' Why is this the case? I was expecting an empty string, or something like json.dumps(d) where None is rendered as null . I'm sure there's a good reason -- just curious about what it is. (One thing I can think of is that maybe there just isn't an encoding of null or None available to the POST request -- is that true?) Additionally curious -- why does requests silently ignore such data instead of

HTTP-POST file multipart

心已入冬 提交于 2019-12-01 06:45:11
I'm trying to send a multipart form using Go packages mime/multipart and http, and I need some help to solve it. The HTML would be: <html> <head><title>Multipart Test</title></head> <body> <form action="/multipart" enctype="multipart/form-data" method="POST"> <label for="file"> Please select a File </label> <input id="file" type="file" name="file"/> <br> <label for="input1"> Please write some text </label> <input id="input1" type="text" name="input1"/> <br> <label for="input2"> Please write some more text </label> <input id="input2" type="text" name="input2"/> <br> <input type="submit" name=

Read POST request parameters properly in PHP for request more than 1450 B?

半世苍凉 提交于 2019-12-01 06:26:19
I receive POST request on my api.php script. The content red using this code: $fp = fopen('php://stdin', 'r'); $all = ""; while($line = fgets($fp, 4096)) { $all .= $line; } echo $all; looks like this: ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="intro" O ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="title" T ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="apiKey" 98d32fdsa ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="method" /media/add ------------V2ymHFg03ehbqgZCaKO6jy Content

Read POST request parameters properly in PHP for request more than 1450 B?

試著忘記壹切 提交于 2019-12-01 06:09:21
问题 I receive POST request on my api.php script. The content red using this code: $fp = fopen('php://stdin', 'r'); $all = ""; while($line = fgets($fp, 4096)) { $all .= $line; } echo $all; looks like this: ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="intro" O ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="title" T ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="apiKey" 98d32fdsa ------------V2ymHFg03ehbqgZCaKO6jy

Android: Volley NoConnectionError

血红的双手。 提交于 2019-12-01 06:01:22
问题 I'm trying to connect to a REST-Server (which I created with Spark) via Android. I can send POST-Requests with POSTMAN (Chrome Addon) and get what I want, but when I try to send the POST request from my Android device, I get the following error: E/error: com.android.volley.NoConnectionError: java.net.ConnectException: failed to connect to /127.0.0.1 (port 4567) after 2500ms: isConnected failed: ECONNREFUSED (Connection refused) This is the server part: Spark.post("/up", new Route() { public

Curl -F equivalent in C#

不想你离开。 提交于 2019-12-01 05:51:23
I am trying to use HTTPClient object in C# to send a post request to an API. This is the CURL command: curl -X POST https://zzz.zzz.zzz/yyy -F Key=abcd -F media=@"audio.aac" I wrote the following code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Net.Http; using System.IO; using System.Net.Http.Headers; namespace Speech2Text { class Program { static void Main(string[] args) { curl().Wait(); } static async Task curl() { var client = new HttpClient(); //Create List of KeyValuePairs List<KeyValuePair<string,

How to send multipart POST request using HttpURLConnection in java?

巧了我就是萌 提交于 2019-12-01 04:39:11
It's my first time sending multipart requests and after digging here, I got even more confused so any help regarding the "correct" way will be very appriciated. I have a function, that should get : file path and a String representation of JSON and send POST request to the server using multipart. I'm not sure when to use the boundary and "multipart/form-data" content type, and the difference between addPart and addTextBody , and when (or why) it is always written Content-Disposition: form-data; name=\ public String foo(String filePath, String jsonRep, Proxy proxy) { File f = new File(filePath);