in reply to Re^2: How to Post a HTTP Request for a JSON web page?
in thread How to Post a HTTP Request for a JSON web page?

I'm not sure on the content ($json) variable I passed in the script. I assumed the below code works.

I didn't ask about the content of the request, I asked about the content of the response

Either one of two things is going on, you're running this as CGI and its failing because its not a CGI (no headers like FAQ says)

Or the response is 500 for some reason ...

So fix the cgi headers if that is the issue

Of examine (or show) the response to see if it says something more , to make sure it is a server response and not internal lwp response

  • Comment on Re^3: How to Post a HTTP Request for a JSON web page?

Replies are listed 'Best First'.
Re^4: How to Post a HTTP Request for a JSON web page?
by vchinnat (Initiate) on Mar 26, 2014 at 10:35 UTC

    Below are the response received.

    "HTTP/1.1 500 Internal Server Error\nConnection: close\nDate: Tue, 14 Aug 2012 05:40:24 GMT\nServer: lighttpd/1.4.28\nContent-Length: 385\nClient-Date: Wed, 26 Mar 2014 10:39:42 GMT\nClient-Peer: 192.168.1.1:80\nClient-Response-Num: 1\nStatus: 500 Internal Server Error\n\n<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n <head>\n <title>500 - Internal Server Error</title>\n </head>\n <body>\n

    500 - Internal Server Error

    \n

    closed

    \n </body>\n</html>\n"

      well, that means the webserver (bartender) is sick -- there is nothing you can do about it (problem at their end)

      The problem might be as simple as no proper error checking, so when you send the webserver(bartender) questionable json values, its just explodes into 500 instead of doing what it was supposed to do

      There is just no way of guessing ... other than recording/reproducing verbatim existing browser sessions, in most every conceivable detail ... all those various headers you're not including like X-JNA....

      I have tried given all the options like X-JNAP-Action, X-JNAP-Authorization, Content_type, charset to the headers but still it didn't help. I have no clue to fix this.

        I have tried given all the options like X-JNAP-Action, X-JNAP-Authorization, Content_type, charset to the headers but still it didn't help. I have no clue to fix this.

        Did you try all of them together?

        This is the reality of internet communication, you're talking with a black box, that black box is free to be as picky and stupid as it wants, if you don't talk to it in exactly the way it wants, it doesn't give you what you want

        If you can use your browser like firefox, to successfully do what you want, you can try WWW::Mechanize::Firefox, its a perl modules that talks to a firefox plugin that drives firefox