Topics
04 Jan 2013, 15:31
 0
 3299
 2
11 Dec 2012, 03:45
 3892
 4
Replies

Walber
11 Dec 2012, 22:30

RE:
admin said:

 

You may use the WebRequest class of System.NET namespace for accessing data from the Internet.

 

See the example here: http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx.

 

Thanks, was a great help.
The following example for sending a message, the web page should be designed to pass a message to a cell phone number.
 
// -------------------------------------------------------------------------------
//
//    This is a Template used as a guideline to build your own Robot.
//    Please use the “Feedback” tab to provide us with your suggestions about cAlgo’s API.
//
// -------------------------------------------------------------------------------
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.IO;
using System.Net;
using System.Text;
namespace cAlgo.Robots
{
    [Robot]
    public class enviodemensagem : Robot
    {
        protected override void OnStart()
        {
     
            // Create a request for the URL.        
            WebRequest request = WebRequest.Create ("http://www.site.asp?moeda=AUD/USD");
            // If required by the server, set the credentials.
            request.Credentials = CredentialCache.DefaultCredentials;
            // Get the response.
            HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
            // Display the status.
            Console.WriteLine (response.StatusDescription);
            // Get the stream containing content returned by the server.
            Stream dataStream = response.GetResponseStream ();
            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader (dataStream);
            // Read the content.
            string responseFromServer = reader.ReadToEnd ();
            // Display the content.
            Print("Arquivo = {0} ",responseFromServer);
            // Cleanup the streams and the response.
            reader.Close ();
            dataStream.Close ();
            response.Close ();
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

@Walber

Walber
11 Dec 2012, 15:31

Test follows the robot,
Walber said:

Olá,
Estou desenvolvendo uma rotina para enviar mensagem para um telefone celular, já tenho a página na INTERNET feito em asp, falta apenas a forma para executar página no ROBOT, alguem pode auxiliar.

Hello,
I'm developing a routine to send message to a cell phone, I have a page on the INTERNET done in asp, missing only way to run the page ROBOT, can someone help.

Test follows the robot,
 
// -------------------------------------------------------------------------------
//
//    This is a Template used as a guideline to build your own Robot.
//    Please use the “Feedback” tab to provide us with your suggestions about cAlgo’s API.
//
// -------------------------------------------------------------------------------
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot]
    public class NewRobot : Robot
    {
        protected override void OnStart()
        {
          system("Arquivos de programas/Internet Explorer/iexplore C:\\Testmessage.asp");
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }
        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

compilation error:

Error: The name 'system' does not exist in the current context

 

 

@Walber

Walber
02 Dec 2012, 19:44

Also I need something, surely an API that could return with a par value of currency different from that reported in robo would be welcome.


@Walber