You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I think I'm getting somewhere with authorisation.
So ask Roman how to do authorisation on the IBM server withWebRequest, that's the key question!
Roman, thanks for the comment! I think we'll manage with authorization as well.
Now about a few parameters. In help on WebRequest it's indicated
[in] Query headers of type "key: value", separated by a line break "\r\n".
The variable headers itself is of type string
What do you mean, the string contains a line break character, i.e. the end of the string?
you must be right, and the screenshot from postman, where the output pair is written in the http request header is explained differently )
i suspect we're still talking about the same thing, but in different words )
I don't know how badly postman is written, what it is, and what it has to do with your problem...
but 90% is solved by reading, and it's up to the person solving the problem to read it.
It's a pretty typical thing - there is documentation of Rest-API service (have you read it by the way??) , you are lucky that they gave an example with curl and no need to parse other languages... and you have to use WebRequest MT.
The curl starts, the protocol is shown on the screen - what headers from parameters are generated and sent, what is received back, how it is understood and where it is put.
And it is directly visible what to send to WebRequest
---
I don't know how badly the postman is written, what it is, or what it has to do with your problem...
but 90% is solved by reading, and it's up to the person who solves the problem to read it.
It's a pretty typical thing - there is documentation of Rest-API service (have you read it by the way??) , you are lucky that they gave an example with curl and no need to parse other languages... and you have to use WebRequest MT.
The curl starts, the protocol is shown on the screen - what headers from parameters are generated and sent, what is received back, how it is understood and where it is put.
And it is directly visible what to send to WebRequest
---
read, read ) Figuring it out and progress is being made.
I think I'm getting there.
Roman, thanks for the comment! I think we'll manage with the authorisation as well.
Now about a few parameters. In help on WebRequest it says
[in] Query headers of type "key: value", separated by a line break "\r\n".
The variable headers itself is of type string
What do you mean, the string contains a line break character, i.e. a line break character?
The header may contain more than one key/value string, so a line break is used.
The double hyphenation"\r\n\r\n" must be placed at the end of the header.
This is how the server understands the end of the header, which is an http standard.
After the double hyphenation comes the body of the request or response.
TheWebRequest function separates these blocks for convenience.
For headers its own parameter, for the body its own.
But the syntax of writing the request, requires compliance with the standard http.
from this websitehttps://example-files.online-convert.com/audio/wav/example.wav
downloads this "example.wav" file
and after downloading it, it playsPlaySound("\\Files\\\example.wav");
-------------------------------------------------
But the meaning of this function ??? I don't think so!
Well, gentlemen, let's move on, shall we?
First of all, let's simplify the code of the request itself as much as possible. Let's leave only one header - the authorization itself, which still works! In this case, without any additional headers, IBM server will give us a stream in .ogg audio format. To hell with it, we think, let's make something work first. Let's abandon futile attempts to format stream to wav with additional headers and deal with .ogg (by the way, similar mistake with WebRequest syntaxhttps://www.mql5.com/en/forum/310891#comment_16643324 )
The script gets logged into the server and hangs. Ok, let's run it in debug mode or something...
see, no? )
We drop the script from the graph, but for some reason it doesn't stop executing completely, it just interrupts the synchronous WebRequest and continues, which is generally to our advantage.
Let's move on. In char result[] we now have an .ogg stream and we write it to a file.
File gets 6Kb too (also, because curl or postman query with the same parameters returns 6Kb .ogg file, which plays properly! Good to hear the word Test ))))
Now we write all char array to file. Specially specify that we should not measure array size, but takeWHOLE_ARRAY.
That is how it looks now:
The only problem is, the curl file plays fine, but our file, for some reason, doesn't.
Let's look inside both files
File downloaded by curl at bottom, filled from WebRequest stream into binary at top
See these blobs 00000089, 00000004 in the top file testmql5.ogg? ))) Is it a bonus program or what? ))) Where did it all come from ))))))))
Summarizing
1. The syntax is still a mystery to me. Only managed to authenticate to the server, attempts to add other headers have failed so far
2. i wonder if WebRequest receives stream with sprinkles, or i'm writing it to a file incorrectly, but the format of .ogg file obtained from char array result using WebRequest method is not correct.
Rotten tomatoes welcome!
from this websitehttps://example-files.online-convert.com/audio/wav/example.wav
downloads this "example.wav" file
and after downloading it, it playsPlaySound("\\Files\\\example.wav");
-------------------------------------------------
But the meaning of this function ??? I don't think it makes any sense!
Alexsandr,
that's great, thanks! But the wav file should be generated by the TTS engine (TextToSpeech)
Alexsandr,
All great, thanks! But the wav file should be generated by TTS engine (TextToSpeech)
I got it - it should work ???
here's something similarhttps://cloud.yandex.ru/docs/speechkit/tts/request
...
Summarising
1. The syntax is still a mystery to me. Only managed to authenticate to the server, attempts to add other headers have failed so far
2. i wonder if WebRequest receives stream with sprinkles, or i'm writing it to a file incorrectly, but the .ogg file format obtained from char array result using WebRequest method is incorrect.
Rotten tomatoes welcome!