Http curl

potman100

Active Member
Licensed User
Longtime User
Hi

I need to connect to a server via http, the problem is that the only example I can find uses curl lib.

curl http://host:8080/sabnzbd/api -F apikey=APIKEY -F mode=addfile -F output=json -F "name=@d:\path\to\my\file.nzb"

I am totally lost with this and looking round the net, seems there is not support for curl under android.

So, my question is can this be emulated in b4a ?

Thanks

Potman
 

potman100

Active Member
Licensed User
Longtime User
Hi worm

Thanks for that Ill take a look, by any chance do you have any example code ?

I normally do thing like this in VB6, and upload to a php script, and would just replace the params with &.

The one I'm not sure about is the name=, the curl lib would read the file and add it to post call.

Any Ideas ?

Regards

Potman
 
Upvote 0

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Post Like a CURL

I need the function/lib like CURL, look my problem:

This command works via CURL


curl --header "Content-Type: audio/x-flac; rate:44000" --data-binary @test.flac "https://www.google.com/speech-api/v2/recognize?lang=es&lm=search&client=myclient&key=MyKey


But when I use the HttpUtils/httpUtils2 I cant to do working.



and I try to like this

Dim request As HttpRequest
request.InitializePost(strGoole,In, size)
request.SetHeader("Content-Type", "audio/x-flac; rate:44000;")
request.SetContentType ("audio/x-flac; rate:44000;")
request.Timeout = 10000
HttpClient1.Execute(request, 1)



what I do wrong???
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
Hi,

can you send me a working example (in curl) keyif needed, test.flac file, etc, I will try to help you, what you need to do (I can do this if you dont know how) is run a sniffer and see whats different between the curl session and your httputil session and change the http util to look the same it might be a header that is mising or handling of some other feature of HTTP...

let me know if you want me to help ...
I need the function/lib like CURL, look my problem:

This command works via CURL


curl --header "Content-Type: audio/x-flac; rate:44000" --data-binary @test.flac "https://www.google.com/speech-api/v2/recognize?lang=es&lm=search&client=myclient&key=MyKey


But when I use the HttpUtils/httpUtils2 I cant to do working.



and I try to like this

Dim request As HttpRequest
request.InitializePost(strGoole,In, size)
request.SetHeader("Content-Type", "audio/x-flac; rate:44000;")
request.SetContentType ("audio/x-flac; rate:44000;")
request.Timeout = 10000
HttpClient1.Execute(request, 1)



what I do wrong???
 
Upvote 0
Top