A simple "echo" webservice for testing
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Echo Webservice

A simple webservice call which echos back data about the request. Can be useful for testing and debugging webservice clients.

Inspired by http://respondto.it/ and http://requestb.in/.

http://httpbin.org/ is similar with lot of additional controls about the response generation.


Make a request to the Echo service using Curl or your webservice client or app:


By default, the service responds with plain text, but can return JSON or XML.

Data Returned

In all data formats, the following data is returned:

  • method: the HTTP method used (GET, HEAD, POST, etc.)
  • headers: all HTTP headers received
  • request: all data parameters (query parameters or POST data)
  • client_ip: best guess at originating client IP address (from HTTP headers)
  • time_utc: request time (UTC)


Plain text response:

$ curl http://scooterlabs.com/echo
    [method] => GET
    [headers] => Array
            [User-Agent] => curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
            [Host] => scooterlabs.com
            [Accept] => */*

    [request] => Array
            [foo] => bar

    [client_ip] =>
    [time_utc] => 2012-01-08T21:33:28+0000
    [info] => Echo service from Scooterlabs (http://www.scooterlabs.com)

Plain text response with public IP address:

$ curl http://scooterlabs.com/echo?ip

JSON response:

$ curl --silent curl http://scooterlabs.com/echo.json?foo=bar | json_xs
   "info" : "Echo service from Scooterlabs (http://www.scooterlabs.com)",
   "request" : {
      "foo" : "bar"
   "headers" : {
      "User-Agent" : "curl/7.21.3 (i386-portbld-freebsd7.3) libcurl/7.21.3 OpenSSL/1.0.0e zlib/1.2.3 libidn/1.22",
      "Accept" : "*/*",
      "Host" : "scooterlabs.com"
   "client_ip" : "",
   "time_utc" : "2012-01-08T22:07:54+0000",
   "method" : "GET"

XML response:

$ curl --silent http://scooterlabs.com/echo.xml?foo=bar | xml_pp

<?xml version="1.0"?>
    <User-Agent>curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3</User-Agent>
  <info>Echo service from Scooterlabs (http://www.scooterlabs.com)</info>


To run on your own server, install echo.php file to a suitable location and add the following to your Apache config or local .htaccess file:

# Echo test script
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^echo /echo.php [L]

If you install echo.php into a location other than the root of your web server, you'll need to adjust the rewrite rules a bit.