473,326 Members | 2,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Susan - desperately seeking ...

Hi Guys (and girls),

I am in a bit of a bind. I'm looking for a simple "proof of concept" C#
app (WinForm OR console) that sends a web request to a simple PHP script
and receives BINARY data back from the PHP script. Binary data is
necessary because I want to be able to send files as well as compressed
(zipped) data.

The example PHP script can ofcourse, simply make up some dummy data and
send it to the C# app. I have tried desperately over the last few weeks
to locate such an example, but have been unsuccesful so far. I would be
most grateful for anyone who can help.

Dec 22 '05 #1
10 1707
Why don't you just post the specs then someone can code it for you, zip it
and post it somewhere for you to download.
"Susan Baker" <sb****@no.spam.net> wrote in message
news:do**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Hi Guys (and girls),

I am in a bit of a bind. I'm looking for a simple "proof of concept" C#
app (WinForm OR console) that sends a web request to a simple PHP script
and receives BINARY data back from the PHP script. Binary data is
necessary because I want to be able to send files as well as compressed
(zipped) data.

The example PHP script can ofcourse, simply make up some dummy data and
send it to the C# app. I have tried desperately over the last few weeks to
locate such an example, but have been unsuccesful so far. I would be most
grateful for anyone who can help.

Dec 22 '05 #2

Chance Hopkins wrote:
Why don't you just post the specs then someone can code it for you, zip it
and post it somewhere for you to download.


Hi Chance, Thanks for the quick response. I have sent you the specs as
well as my private email. I look forward to hearing from you.

Regards,

Sue

Dec 22 '05 #3
On Thu, 22 Dec 2005 02:58:41 +0000, Susan Baker wrote:
Hi Guys (and girls),

I am in a bit of a bind. I'm looking for a simple "proof of concept" C#
app (WinForm OR console) that sends a web request to a simple PHP script
and receives BINARY data back from the PHP script. Binary data is
necessary because I want to be able to send files as well as compressed
(zipped) data.

The example PHP script can ofcourse, simply make up some dummy data and
send it to the C# app. I have tried desperately over the last few weeks
to locate such an example, but have been unsuccesful so far. I would be
most grateful for anyone who can help.


Susan, why don't you install PEAR MAIL_Mime package and send the binary
data by email? What you want is, basically, to send data from PHP script
to an application. That is usually done through messaging/queueing
applications like MQSeries (part of WebSphere) or Tibco's RendesVous.
In the absence of such complex queueing systems, an ordinary email
might do the trick. It can be configured and played with, to make sure
that the mail ends up on the right address.
Another solution for two diverse system to communicate is to share a
database. Binary data would then be uploaded as a BLOB field and the
row pointer would be passed to the client.

--
http://www.mgogala.com

Dec 22 '05 #4
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"].

Dec 22 '05 #5
Mladen Gogala <go****@sbcglobal.net> wrote:
I am in a bit of a bind. I'm looking for a simple "proof of concept" C#
app (WinForm OR console) that sends a web request to a simple PHP script
and receives BINARY data back from the PHP script. Binary data is
necessary because I want to be able to send files as well as compressed
(zipped) data.

The example PHP script can ofcourse, simply make up some dummy data and
send it to the C# app. I have tried desperately over the last few weeks
to locate such an example, but have been unsuccesful so far. I would be
most grateful for anyone who can help.


Susan, why don't you install PEAR MAIL_Mime package and send the binary
data by email? What you want is, basically, to send data from PHP script
to an application. That is usually done through messaging/queueing
applications like MQSeries (part of WebSphere) or Tibco's RendesVous.
In the absence of such complex queueing systems, an ordinary email
might do the trick. It can be configured and played with, to make sure
that the mail ends up on the right address.
Another solution for two diverse system to communicate is to share a
database. Binary data would then be uploaded as a BLOB field and the
row pointer would be passed to the client.


That all sounds very complicated, considering that from all we've been
told, a simple web solution is a perfectly good (and *much* easier)
solution. After all, a browser requesting an image conforms exactly to
the situation Susan specified. There's no need to get message queues,
email or a database involved.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 22 '05 #6
Susan Baker <sb****@no.spam.net> wrote:
Hi Guys (and girls),

I am in a bit of a bind. I'm looking for a simple "proof of concept" C#
app (WinForm OR console) that sends a web request to a simple PHP script
and receives BINARY data back from the PHP script. Binary data is
necessary because I want to be able to send files as well as compressed
(zipped) data.

The example PHP script can ofcourse, simply make up some dummy data and
send it to the C# app. I have tried desperately over the last few weeks
to locate such an example, but have been unsuccesful so far. I would be
most grateful for anyone who can help.


I'd suggest splitting your problem into two parts:

1) Write a PHP script which can spit back the dummy data. (You can test
this with a web browser)

2) Write a C# client app which can download data from an arbitrary URL.
(You can test this with a web server with a dummy file on.)

If you get stuck on either part, please post on the appropriate group
with how far you've got.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 22 '05 #7
Following on from Jon Skeet's message. . .

I'd suggest splitting your problem into two parts:
Good idea

RFC 2616 tells you how to compose HTTP requests and interpret the HTTP
responses. (Not surprisingly, that's what PHP uses for all it's web
work.)

1) Write a PHP script which can spit back the dummy data. (You can test
this with a web browser)

2) Write a C# client app which can download data from an arbitrary URL.
(You can test this with a web server with a dummy file on.)

If you get stuck on either part, please post on the appropriate group
with how far you've got.


--
PETER FOX Not the same since the bookshop idea was shelved
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Dec 22 '05 #8
Peter Fox <pe******@eminent.demon.co.uk.not.this.bit.no.html > wrote:
I'd suggest splitting your problem into two parts:


Good idea

RFC 2616 tells you how to compose HTTP requests and interpret the HTTP
responses. (Not surprisingly, that's what PHP uses for all it's web
work.)


Fortunately, that's not really required in C# - .NET provides plenty of
infrastructure for making HTTP requests very easily.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 22 '05 #9
On Thu, 22 Dec 2005 06:32:16 +0000, Jon Skeet[ C# MVP] wrote:
That all sounds very complicated, considering that from all we've been
told, a simple web solution is a perfectly good (and *much* easier)
solution. After all, a browser requesting an image conforms exactly to
the situation Susan specified. There's no need to get message queues,
email or a database involved.


I don't know a squat about .NOT so I attacked the most general case.
I read some of the solutions and, at least from the PHP side, they're
trivial. Of course, I'd prefer Chung to express himself in some of humanly
readable languages instead of C#.

--
http://www.mgogala.com

Dec 22 '05 #10
Mladen Gogala <go****@sbcglobal.net> wrote:
On Thu, 22 Dec 2005 06:32:16 +0000, Jon Skeet[ C# MVP] wrote:
That all sounds very complicated, considering that from all we've been
told, a simple web solution is a perfectly good (and *much* easier)
solution. After all, a browser requesting an image conforms exactly to
the situation Susan specified. There's no need to get message queues,
email or a database involved.
I don't know a squat about .NOT so I attacked the most general case.


Fair enough. I'd suggest that those in the PHP newsgroup start at the
PHP side, and those in the C# group start on the C# side.
I read some of the solutions and, at least from the PHP side, they're
trivial.
Good - likewise on the C# side, to be honest. I suspect the problem was
that the OP wasn't sure where to start. Hopefully the suggestion of
"faking" each side while developing the other will have helped.
Of course, I'd prefer Chung to express himself in some of humanly
readable languages instead of C#.


Please, let's not start a flame war. I doubt whether you're any more
likely to persuade me that PHP is superior to C# than I am to persuade
you that C# is superior - nor am I particularly interested in trying to
do that anyway.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 22 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rdshultz | last post by:
I'm a complete newbie. Need to insert a Company logo into a database column to use later on in a check printing application. Read how to insert the pointer instead of the object into the column. ...
5
by: Rudy | last post by:
I am desperately seeking some help with a program that was supposed to have been completed last night. I have only been working with PHP for a week. I have tried and tried and tried, but I am...
0
by: chrisben | last post by:
Hi, Developing Env: .NET Studio in C#, windows 2000 target: a COM object used for excel user (RTD) I have no problem to compile and run the project in my machine. The excel is working great...
10
by: Susan Baker | last post by:
Hi Guys (and girls), I am in a bit of a bind. I'm looking for a simple "proof of concept" C# app (WinForm OR console) that sends a web request to a simple PHP script and receives BINARY data...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.