|
Joined: Apr 2001
Posts: 237
Member
|
Member
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: - 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?
- How do I actually make the data readable from STDIN on the receiving script? Pipe it? Open a socket and dump it?
Thanks all!
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
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)
|
|
|
|
Joined: Apr 2001
Posts: 237
Member
|
Member
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
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
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.
|
|
|
|
Joined: Apr 2001
Posts: 237
Member
|
Member
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
Joined: Apr 2001
Posts: 237 |
Cool, thanks, I'll check that out. (I hope a search for LWP will get me there... )
|
|
|
|
Joined: Aug 2000
Posts: 874
Moderator / Developer
|
Moderator / Developer
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
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...
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
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.
|
|
|
|
Joined: Aug 2000
Posts: 874
Moderator / Developer
|
Moderator / Developer
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
Joined: Apr 2001
Posts: 237 |
Thanks CC! Now that's service!
|
|
|
|
Joined: Apr 2001
Posts: 237
Member
|
Member
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
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
Junior Member
|
Junior Member
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
Joined: Apr 2001
Posts: 237 |
Dave_L,
That's it, I'm now getting proper messages back!
Thanks man!
|
|
|
|
Joined: Jan 2001
Posts: 10
Junior Member
|
Junior Member
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?
|
|
|
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.
|
|
Posts: 417
Joined: November 2001
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|