Previous Thread
Next Thread
Print Thread
Rate Thread
#103447 12/29/2001 10:56 AM
Joined: Apr 2001
Posts: 237
Member
Member
Offline
Joined: Apr 2001
Posts: 237
I'm stuck, and I know some of the gurus here can help.

What I want is to be able to have a PERL script make an automated post to a UBB forum. I've got it pretty much done, except for setting up the actual HTTP POST command. I've done GETs through a script before, but never a POST. So, my specific questions are:

  1. What "pre processing" has to be done to the data before it can be posted? (For example, turning spaces into +'s.) Anyone have a code snippet?
  2. How do I actually make the data readable from STDIN on the receiving script? Pipe it? Open a socket and dump it?



Thanks all!

Sponsored Links
#103448 12/29/2001 12:14 PM
Joined: Aug 2000
Posts: 335
Member
Member
Offline
Joined: Aug 2000
Posts: 335
Just use CGI.pm. It automatically deals with POST and GET.

1. I don't think you have to do anything special. Try it and see.

2. Blah (with CGI.pm, you don't have to deal with that)

#103449 12/29/2001 12:55 PM
Joined: Apr 2001
Posts: 237
Member
Member
Offline
Joined: Apr 2001
Posts: 237
Dave,

I could be wrong, but doesn't CGI.pm just allow you to accept and generate POSTed forms? I actually want to do the POST (I.E. act as the web server, when a user hits submit on a web form).

If CGI.pm does that, great! Any clues as to where to start?

Thanks

Joined: Aug 2000
Posts: 335
Member
Member
Offline
Joined: Aug 2000
Posts: 335
I guess I misunderstood your question.

[ 12-29-2001 06:29 PM: Message edited by: Dave_L ]

Joined: Dec 2000
Posts: 730
deutscher moderator / v5 specialist
deutscher moderator / v5 specialist
Offline
Joined: Dec 2000
Posts: 730
i think you mean...
the user click on "submit" of a feedback form and then the ubb generate a topic in a special forum...

one way is:
the "form"-script, generate the topic with the code of sub submit_new_topic.

Sponsored Links
#103452 12/31/2001 11:13 AM
Joined: Apr 2001
Posts: 237
Member
Member
Offline
Joined: Apr 2001
Posts: 237
Not quite. Specifically, this script is going to intercept all e-mail sent to a specific address. It parses out the good bits, and then posts it to a specific forum. So the forum is then an online archive of the mailing list.

The problem I'm having is automating the "posting" of the message contents.

Cheers

Joined: May 2000
Posts: 1,356
Addict
Addict
Joined: May 2000
Posts: 1,356
well... I dont know the answer, but you can look at lwp & other net modules for this...

Joined: Apr 2001
Posts: 237
Member
Member
Offline
Joined: Apr 2001
Posts: 237
Cool, thanks, I'll check that out. (I hope a search for LWP will get me there... )

#103455 01/03/2002 11:37 PM
Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
LWWP or LWWWP can never remember which does what you want. theres some good docs on it if you seach google or cpan.

Joined: Apr 2001
Posts: 237
Member
Member
Offline
Joined: Apr 2001
Posts: 237
CPAN shows:

LWWWP: 0 hits
LWWP: 0 hits
LWP: 123 hits



If I find the right one, I'll post it here for reference...

Sponsored Links
Joined: Aug 2000
Posts: 335
Member
Member
Offline
Joined: Aug 2000
Posts: 335
I'm not sure what you guys are talking about.

There's a CPAN download libwww-perl-5.63.tar.gz which might be relevant.

http://perldoc.com/ is also a good reference.

#103458 01/04/2002 10:18 PM
Joined: Aug 2000
Posts: 874
Moderator / Developer
Moderator / Developer
Offline
Joined: Aug 2000
Posts: 874
lwwwp = libwww-perl

Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
[code][/code]

Tada.

Assemble the $query_string as if it was a real query string.


UBB.classic: Love it or hate it, it was mine.
Joined: Apr 2001
Posts: 237
Member
Member
Offline
Joined: Apr 2001
Posts: 237
Thanks CC! Now that's service!

#103461 01/20/2002 10:10 AM
Joined: Apr 2001
Posts: 237
Member
Member
Offline
Joined: Apr 2001
Posts: 237
Ok, looks like it's the right idea. I'm now getting a response like this:

[code][/code]

Anyone have an idea how I can get something more meaningful from that? I've tried receiving it as a hash and pulling that apart, but it's the same result...

Joined: Aug 2000
Posts: 335
Member
Member
Offline
Joined: Aug 2000
Posts: 335
I haven't used LWP::UserAgent, but according to the documentation, $response_code (as used above) is a reference to an HTTP::Response object.

Instead of printing $response_code, try printing $response_code->as_string(). See the documentation for HTTP::Response for other methods.

Joined: Jan 2001
Posts: 10
fiz Offline
Junior Member
Junior Member
Offline
Joined: Jan 2001
Posts: 10
quote:
Originally posted by joking-down:
i think you mean...
the user click on "submit" of a feedback form and then the ubb generate a topic in a special forum...

one way is:
the "form"-script, generate the topic with the code of sub submit_new_topic.



That's exactly what I myself need to do for a news submission script for a web site.

Can anyone give me a "sample" script I can just steal code from? I'm kind of in a hurry and I'm busy worrying about more complicated procedures with teh said Perl script.

Thanks.

Joined: Apr 2001
Posts: 237
Member
Member
Offline
Joined: Apr 2001
Posts: 237
Dave_L,

That's it, I'm now getting proper messages back!

Thanks man!

Joined: Jan 2001
Posts: 10
fiz Offline
Junior Member
Junior Member
Offline
Joined: Jan 2001
Posts: 10
quote:
Originally posted by Mike Bobbitt:
Dave_L,

That's it, I'm now getting proper messages back!

Thanks man!

Could I get a copy of your code snippet for auto-thread creation via an external perl script, by any chance?


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Nettomo
Nettomo
Germany, Bremen
Posts: 417
Joined: November 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)