You are here: Re: Susan - desperately seeking ... « PHP Programming Language « IT news, forums, messages
Re: Susan - desperately seeking ...

Posted by Chung Leong on 12/22/05 07:47

C# is not my forte but here's a very basic example:

private void button1_Click(object sender, System.EventArgs e)
{
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://localhost/file.php");
request.Headers["Something"] = "Dingo";
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Stream hs = response.GetResponseStream();
FileStream fs = new FileStream("C:\\test.gif", FileMode.Create,
FileAccess.Write);
BinaryWriter bw = new BinaryWriter(fs);
BinaryReader br = new BinaryReader(hs);
Byte[] buffer;
do {
buffer = br.ReadBytes(1024);
bw.Write(buffer);
} while(buffer.Length > 0);
bw.Close();
br.Close();
}


The PHP script just dumps a gif file into the output:

<? readfile("dingo.gif"); ?>

I suggested using the HTTP headers to pass parameters in another post,
as it's fairly easy to set their values. In the PHP script, the
"Something" header will become $_SERVER['HTTP_SOMETHING']. The PHP
script can set response header using the header() function:

header("Dingo: Ate my wienerschnitzel!");

Which then is accessible through HttpWebResponse.Headers["Dingo"].

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация