Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: XPOST syntax in WWW::Curl

by Corion (Patriarch)
on Feb 01, 2015 at 13:34 UTC ( [id://1115218]=note: print w/replies, xml ) Need Help??

in reply to XPOST syntax in WWW::Curl

You will have to learn one of the two. Maybe HTTP::Request::Common is enough to produce a POST request, but you will have to learn HTTP in either case anyway.

A very simplicistic approach could be to dump what curl sends over the network, and then replicate the request with LWP::UserAgent, printing that until you get the same results.

Replies are listed 'Best First'.
Re^2: XPOST syntax in WWW::Curl
by Steve_BZ (Chaplain) on Feb 01, 2015 at 13:41 UTC

    Ok, nice. How do I find out what Curl sends over the network?

      Either use Wireshark or look at the Curl documentation. On a quick glance, either --verbose or --trace make Curl dump everything it sends or receives.

      Again, you will have to learn Curl and HTTP in either case, so now is a good time to start with that.

      As I now found out, I already said the same, even more verbose, in Re: CURL and Perl (it rhymes!). So maybe re-reading that thread helps.

        Hi Corion,

        So I tried the -v option and I got some more info, which follows, but I wouldn't know how to match this to the code you posted in the other thread.

        It seems to do a POST and then there seem to be some fields with some values, is that correct? Like User-Agent: curl/7.35.0

        What do you think?


        * Hostname was NOT found in DNS cache * Trying % Total % Received % Xferd Average Speed Time Time Time + Current Dload Upload Total Spent Left + Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--: +-- 0* Connected to port 8098 (#0 +) > POST /api/resultados/ HTTP/1.1 > User-Agent: curl/7.35.0 > Host: > Accept: */* > Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > Content-Length: 949 > Expect: 100-continue > Content-Type: multipart/form-data; boundary=------------------------ +daf19fd44f6a97e8 > * Done waiting for 100-continue 0 949 0 0 0 0 0 0 --:--:-- 0:00:01 --:--: +-- 0} [data not shown] < HTTP/1.1 100 Continue < HTTP/1.1 201 CREATED * Server nginx/1.1.19 is not blacklisted < Server: nginx/1.1.19 < Date: Sun, 01 Feb 2015 14:48:34 GMT < Content-Type: application/xml; charset=utf-8 < Transfer-Encoding: chunked < < [data not shown] Connection: keep-alive < Vary: Accept < X-Frame-Options: SAMEORIGIN < Allow: GET, POST, HEAD, OPTIONS < { [data not shown] 100 1142 0 193 100 949 84 416 0:00:02 0:00:02 --:--: +-- 416 100 1142 0 193 100 949 84 416 0:00:02 0:00:02 --:--: +-- 416 * Connection #0 to host left intact
      Did you read the thread you linked to in the OP?

      Cheers Rolf

      PS: Je suis Charlie!

        Hi Rolf, Of course I read it, but nothing really gelled.


Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-06-22 05:51 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.