Executing POST command with webserver for php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sureshsundar007
Forum Newbie
Posts: 4
Joined: Fri Dec 26, 2003 10:59 pm

Executing POST command with webserver for php

Post by sureshsundar007 »

Hi all,

I'm building my own web server on C#.I'm trying to support php with my server.I'm having problems when

executing POST command.I'm testing a webmail written in PHP with my server.I dont know how to pass both

the querystring and body as parameters to php executor in the webserver.

If querystring or body is empty then it works fine for me as i pass the argument like this...

1)c:\php\php.exe "c:\filename.php" querystring ,when body is empty and

2)c:\php\php.exe "c:\filename.php" body, when querystring is empty ...

but i dont how how to pass both vales simultaneously(when both are not empty) as arguments like

c:\php\php.exe "c:\filename.php" querystring body...which doesnt works and also tried

c:\php\php.exe "c:\filename.php" querystring&body ...doesnt works and also tried

c:\php\php.exe "c:\filename.php" querystring\r\n\r\nbody ...which also doesnt works.

please help..

Thanks,
Suresh.
sureshsundar007
Forum Newbie
Posts: 4
Joined: Fri Dec 26, 2003 10:59 pm

Post by sureshsundar007 »

Let me explain the problem more clearly.

I can able to execute normal scripts without any problems.The problem is when executing scripts when adding attachments.

After getting the POST command like this..

POST /upload.php?sid={4010F46F0F2BD-4010F46F0F2D8-1074852975} HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint,
application/vnd.ms-excel, application/msword, */*
Referer: http://localhost/upload.php?sid={4010F4 ... id=0&lid=5
Accept-Language: en-us
Content-Type: multipart/form-data; boundary=---------------------------7d43868360442
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)
Host: localhost
Content-Length: 400
Connection: Keep-Alive
Cache-Control: no-cache

I'm getting the attachment data (after POST command) like this....

-----------------------------7d43868360442
Content-Disposition: form-data; name="userfile"; filename="C:\dloads\isha.txt"
Content-Type: text/plain

22413544
044-22413544
22381766

091-44-2433-3185


chrompet contacts
22652544

22381766


-----------------------------7d43868360442
Content-Disposition: form-data; name="submit"

Send
-----------------------------7d43868360442--

The problem now is ...

If i'm correct the query string i get from the command is "sid={4010F46F0F2BD-4010F46F0F2D8-1074852975}" and also i've the
attachment body.How to pass these 2 values to the PHP executor?Do i have to parse and edit this attachment data and create a
new data with special headers?

Please help..

Thanks,
Suresh.
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

Wow, that's ambitious. I can't help you, but wondered if you thought of looking at the apache source code as to how they do it.
sureshsundar007
Forum Newbie
Posts: 4
Joined: Fri Dec 26, 2003 10:59 pm

Post by sureshsundar007 »

Thanks for your reply hedge.

I did have the apache source code and i'm struggling to find how it happens in apache as i'm very poor in VC++.

So,If you know how to do it please help me as i'm struggling to fix this for a very long time.

Thanks,
Suresh.
Post Reply