I'm really new to Unix and I can't figure out what this command does. From what I understand, it sends an HTTP POST request to a website. I don't know exactly what each line is supposed to do. What is the function of each line?

Here's the command:

curl http://www.example.com/xmlrpc.php -d 

  • What it does entirely depends on xmlrpc.php. You are sending data as part of the POST request, but it's up to xmlrpc.php to interpret that data as grounds for action. – Chris Down Jan 27 '14 at 3:28
  • @ChrisDown Okay, I see. What exactly do the ' ' do? I'm guessing they're equivalent to brackets {} in programming? – Sedulous Jan 27 '14 at 3:36

This is most likely a Wordpress website. The xmlrpc.php script is a PHP script that provides remote procedure calls (hence the rpc in the name) which allow you to run things on the server. These are just like methods in a Class.


<?xml version="1.0"?>

When you call the URL in your example, you're calling the pingback.ping method and providing the URLs after the call as arguments to this method. The 1st URL is the source URL of the pingback while the 2nd is the target URL.

curl's -d switch

From curl's man page:

-d/--data <data>
      (HTTP) Sends the specified data in a POST request to the HTTP server, 
      in a way that can emulate as if a user has filled in a HTML form and 
      pressed the submit  button.  Note  that  the  data  is  sent exactly 
      as specified with no extra processing (with all newlines cut off).  
      The data is expected to be "url-encoded". This will cause curl to pass 
      the data to the server using the content-type 
      application/x-www-form-urlencoded. Compare to -F/--form. If this 
      option is used more than once on the same command line, the data 
      pieces specified will be merged together with a separating &-letter. 
      Thus, using ’-d name=daniel -d skill=lousy’ would generate a post 
      chunk that looks like ’name=daniel&skill=lousy’.

      If  you  start  the  data  with  the  letter @, the rest should be a 
      file name to read the data from, or - if you want curl to read the 
      data from stdin.  The contents of the file must already be 
      url-encoded. Multiple files can also be specified. Posting data from a 
      file named ’foobar’ would thus be done with --data @foobar".

      To post data purely binary, you should instead use the --data-binary 

      -d/--data is the same as --data-ascii.

      If this option is used several times, the ones following the first 
      will append data.
| improve this answer | |
  • @Sedulous - glad to of helped. Thanks for the Q. – slm Jan 27 '14 at 4:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.