Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: 400 bad request curl post

by kschwab (Vicar)
on Dec 06, 2018 at 15:37 UTC ( [id://1226847]=note: print w/replies, xml ) Need Help??


in reply to Re^3: 400 bad request curl post
in thread 400 bad request curl post

His client is also a CGI script...see the last few lines.

Replies are listed 'Best First'.
Re^5: 400 bad request curl post
by 1nickt (Canon) on Dec 06, 2018 at 16:34 UTC

    Sorry, but no, his code only implements a client with LWP and makes a request, then prints out something from the response. I think you're misunderstanding what a "CGI script" is. (Here's a recent article which, although its main point is to urge that new server-side code developed in Perl should avoid CGI.pm, provides some good terminology definitions. Note that the OP's script is not serving anything but simply trying to fetch the content of a web page.)


    The way forward always starts with a minimal test.
      makes a request, then prints out something from the response

      with print "Content-type: text/html\n\n"; in between

      I respectfully disagree.

      It prints out the "Content-type:" header, and and dumps out some html. So, if it's dropped into the right place, it certainly is a "CGI script". It may get the content via LWP, but that doesn't change anything. You can write a "cgi script" in /bin/sh. If it happens to get it's content with curl that doesn't suddenly make it not a CGI script.

      CGI.pm has nothing to do with anything at all in this case.

        Well, I suppose you may be right. I considered both the OP's history of throwing random snippets of code into his scripts, and also the fact that the request he is making is apparently to an API that expects and returns JSON, so I figured he was still in the debugging phase trying to get and print his JSON response. Didn't occur to me that his script intended to simply dump the request response to a browser.


        The way forward always starts with a minimal test.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1226847]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 17:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found