using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
namespace wget
{
class Program
{
static void Main(string[] args)
{
//string res = wget("http://www.google.com");
if (args.Length == 0)
{
Console.WriteLine("Debe especificar una url");
}
else
{
string uri = args[0];
if (uri.Contains("htt"))
{
Console.WriteLine(wget(uri));
}
else
{
Console.WriteLine("No es válido");
}
//Console.ReadKey();
}
}
private static string wget(string url)
{
WebClient c = new WebClient();
byte[] response = c.DownloadData(url);
return Encoding.ASCII.GetString(response);
}
}
}
<?php
if(isset($_REQUEST['name']))
{
echo gethostbyname($_REQUEST['name']);
}
else
{
echo gethostbyname("www.google.com");
}
?>
Usos:
wget http://www.google.com
wget http://servidor/GetHostByName.php?name=www.google.com
No hay comentarios:
Publicar un comentario