The server answers with an error, so you touch the server but the requested web-page seems not to exist.
This works for me:
string GrabWeb(string strUrl) {//>4 string headers,ret; char post[],result[]; int res, timeout=5000; res=WebRequest("GET",strUrl,NULL,timeout,post,result,headers); if (res < 0) { Alert("Web-Error: ",GetLastError()," (4060 ERR_FUNCTION_NOT_CONFIRMED/Url not allowed)" ); return(""); } ret = CharArrayToString(result,0,-1); return(ret); }
The server answers with an error, so you touch the server but the requested web-page seems not to exist.
This works for me:
Thanks for your post.
I'm trying to POST a line to an existing html document not GET. Could you send a simple example for POST as well. I'm not quite sure how can I POST a new line to the existing html document,
Suppose that the URL is www.mywebpage.com/index.htm
I understand that index.html must exists. This is fine also I do not get any authentication problems. The only error I guess is about syntax, I need to refine "the string" accordingly however I don't know how to do it, I couldn't find any documentation as well.
Thanks for your post.
I'm trying to POST a line to an existing html document not GET. Could you send a simple example for POST as well. I'm not quite sure how can I POST a new line to the existing html document,
Suppose that the URL is www.mywebpage.com/index.htm
I understand that index.html must exists. This is fine also I do not get any authentication problems. The only error I guess is about syntax, I need to refine "the string" accordingly however I don't know how to do it, I couldn't find any documentation as well.
hmm - can't you copy the url from the url-line of the browser and pack that between two " - like strUrl = "https://forum.mql4.com/69624#1022641"?
If I call this page: "http://www.mywebpage.com/index5.htm" I see this url isn't valid any more!
hmm - can't you copy the url from the url-line of the browser and pack that between two " - like strUrl = "https://forum.mql4.com/69624#1022641"?
If I call this page: "http://www.mywebpage.com/index5.htm" I see this url isn't valid any more!
It was just an example, I didn't want to give real webpage name. I'm willing to know what would be the syntax for the data[] array if I want to POST something to an html file. I already understand how to add syntax for authentication but there is no information for the html part, header, normal letters etc.
Hello everyone.
I hope someone can help me. I have a protected file in my website and I want to download it from a expert advisor. If the file were not protected is very easy with Webrequest method, but being protected all change and I haven't was able to download it. I will really appreciate if someone could tell me what modifications that I must make to webrequest method in order to get download the file to my computer.
Best regards.
William
Hello everyone.
I hope someone can help me. I have a protected file in my website and I want to download it from a expert advisor. If the file were not protected is very easy with Webrequest method, but being protected all change and I haven't was able to download it. I will really appreciate if someone could tell me what modifications that I must make to webrequest method in order to get download the file to my computer.
Best regards.
William
What do you mean by protected ?
Thanks for you reply. I have the file protected with .htaccess and .htpasswd . If someone want to get the file will have enter an user and password.
Thanks for you reply. I have the file protected with .htaccess and .htpasswd . If someone want to get the file will have enter an user and password.
So add them to your request.
If you are using basic authentication, something like :
http://validuser:validpassword@www.domain.com/yourfile
Otherwise you need to use headers, this is beyond the scope of this site. You need to learn http protocol.
So add them to your request.
If you are using basic authentication, something like :
Otherwise you need to use headers, this is beyond the scope of this site. You need to learn http protocol.
ok. Thank you very much.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I've searched the forum and checked https://docs.mql4.com/common/webrequest site but couldn't come to a conclusion.
I'm willing to send specific outputs (such as orders, information about ea) to external web page. I do not get any authhorization errors but I'm getting the following kind of errors:
-----------------------------------------
Status code: 404, error: 4000
Server response: <!DOCTYPE html>
<html style="height:100%">
<head><title> 404 Not Found
</title></head>
<body style="color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;">
<div style="height:auto; min-height:100%; "> <div style="text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;">
<h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">404</h1>
<h
--------------------------------------------
Server response: <html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 12">
<meta name=Originator content="Microsoft Word 12">
----------------------------
I get the errors because (I guess) the "data" format is not prepared for the web page. I do not know how to prepare the string for the url;
Are there any other examples or documentation how to put a new line to existing htm file or creating a new one?
I would appreciate if someone could guide me.
Thanks