Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/12/2009, 21:05
Avatar de Hijo_Del_Mal
Hijo_Del_Mal
 
Fecha de Ingreso: diciembre-2009
Mensajes: 2
Antigüedad: 14 años, 5 meses
Puntos: 0
Busqueda Leer un archivo .php en c#

Hola a todos, quisiera hacer la lectura del codigo fuente de un archivo .php en el estilo forosdelweb.com/index.php donde el archivo esta en la web y tiene extencion .php, intente con :

Código:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {

        StreamReader objReader;
        string AbrirURL;
        string sLine;

        public Form1()
        {
            InitializeComponent();
            // no lo pude poner bien por no me deja postearlo pero con el http y los www lo puse
            AbrirURL = "forosdelweb.com/index.php";
            sLine = "";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            objReader = new StreamReader(AbrirURL);

            while (this.sLine != null)
            {
                this.sLine = objReader.ReadLine();
                if (sLine != null)
                    this.AreaTexto.Text = this.AreaTexto.Text + this.sLine + "\n";
            }
            objReader.Close();
            this.sLine = "";
        }
    }
}
Al ir a buscar la url se cae.

Saludos y gracias de antemano.