473,386 Members | 1,652 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,386 software developers and data experts.

CGI and multipart/related data

I'm trying to implement a WAP Push Protocol Gateway, using Push Access
Protocol over HTTP, and I'm having problems.

Ignoring all the buzzwords, my CGI program receives a post something
like:

POST /cgi-bin/wap_push.cgi HTTP/1.1
Host: www.wireless-network.com
Date: Sun, 16 May 1999 18:13:23 GMT
Content-Type: multipart/related; boundary=asdf; type="application/xml"
Content-Length: 353

--asdf
Content-Type: application/xml
<?xml version="1.0"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAD 2.0//EN"
"http://www.wapforum.org/DTD/pap_2.0.dtd"
[<?wap-pap-ver supported-version="2.0,1.*"?>]>
<pap>
...control...
</pdp>
--asdf
...content entity ..
--asdf--

The first problem ism how do I extract the multipart/related data? The
CGI modules do not appear to handle this sort of stuff, and despitre
searching www.perl.com and CPAN, I cannot see any obvious modules that
do what I want.

I think that XML::Simple will be suitable for the simple XML i expect,
but if anyone has any better suggestions, I would be more than happy
to receive them.

Thanks,

Simon Callan
Jul 19 '05 #1
2 5320
I would parse STDIN and put everything after "Content-Type:
application/xml" into a $string. Then use XML::SAX or XML::Twig to
parse the data. It all depends on what you want to do with the XML
data.

--
Andrés Monroy-Hernández

si***@callan.demon.co.uk (Simon Callan) wrote in message news:<31**************************@posting.google. com>...
I'm trying to implement a WAP Push Protocol Gateway, using Push Access
Protocol over HTTP, and I'm having problems.

Ignoring all the buzzwords, my CGI program receives a post something
like:

POST /cgi-bin/wap_push.cgi HTTP/1.1
Host: www.wireless-network.com
Date: Sun, 16 May 1999 18:13:23 GMT
Content-Type: multipart/related; boundary=asdf; type="application/xml"
Content-Length: 353

--asdf
Content-Type: application/xml
<?xml version="1.0"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAD 2.0//EN"
"http://www.wapforum.org/DTD/pap_2.0.dtd"
[<?wap-pap-ver supported-version="2.0,1.*"?>]>
<pap>
..control...
</pdp>
--asdf
..content entity ..
--asdf--

The first problem ism how do I extract the multipart/related data? The
CGI modules do not appear to handle this sort of stuff, and despitre
searching www.perl.com and CPAN, I cannot see any obvious modules that
do what I want.

I think that XML::Simple will be suitable for the simple XML i expect,
but if anyone has any better suggestions, I would be more than happy
to receive them.

Thanks,

Simon Callan

Jul 19 '05 #2
an****@monroy.com (Andres Monroy-Hernandez) wrote:
I would parse STDIN and put everything after "Content-Type:
application/xml" into a $string. Then use XML::SAX or XML::Twig to
parse the data. It all depends on what you want to do with the XML
data.


Handling the XML bit is simple - I'm simply throwing it at
XML::Simple.

The biggest problem is that none of the CGI packages I have seen cope
with multipart/related data, so I had to write that bit myself.

Simon
Jul 19 '05 #3

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

Similar topics

34
by: Niels Berkers | last post by:
Hi, i'd like to host my web pages using multiparts to reduce the number of hits on the server. i know this isn't a real PHP subject, but i'll try it anyway. i've been searching the web for...
2
by: Damien | last post by:
Hi to all, After hours of attempts and "googling", I'm still pulling my hair off my head when I try to send multipart html emails. It "works" on PCs with Outlook when I juste send a single...
4
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET...
7
by: Mark Waser | last post by:
Hi all, I'm trying to post multipart/form-data to a web page but seem to have run into a wall. I'm familiar with RFC 1867 and have done this before (with AOLServer and Tcl) but just can't seem...
8
by: Ben R. | last post by:
Hi all, This is a multipart question. I’ve got an asp.net site that contains an access database. Previously, I would debug by making changes and uploading to my host. Now, I’d like to be...
4
by: pbd22 | last post by:
hi. could somebody tell me, when uploading a file, i know the form where the upload component is must have enctype=multipart/form-data but, is the same true for the form with the server code to...
4
by: vunet.us | last post by:
Hi all, I am converting my app to AJAX-based. I have a form that submits some data including images. When I use AJAX XmlHttpRequest I am unable to submit the form with...
2
by: gezerpunta | last post by:
Hi I used pear api to make this mail but I can t add multipart.My mail structure is like that. part 1: a file part 2: multipart part 1: a file part 2: a file
6
by: fnoppie | last post by:
Hi, I am near to desperation as I have a million things to get a solution for my problem. I have to post a multipart message to a url that consists of a xml file and an binary file (pdf)....
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.