Test network services

From WickyWiki
Revision as of 06:48, 2 September 2013 by Wilbert (talk | contribs) (Created page with "Category:201309 Category:Network Curl allows you to simulate http requests so you can do webservice calls, get internet pages, post internet forms etc. It handles all...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Curl allows you to simulate http requests so you can do webservice calls, get internet pages, post internet forms etc. It handles all the things that a client should handle like SSL encryption, authentication, discovery etc. There is a PHP wrapper that allows you to use it for your PHP webapplications. For now I added some information for the commandline utility that is great for testing,

Install curl

sudo apt-get install curl

Commandline

Some options:

curl 
    --request <httpcommand>     http command, for example: GET, HEAD, POST, OPTIONS, PUT
    --insecure                  allow invalid or self-signed certificate
    --user <user>:<password>    omit the password and you will be asked for it
    --verbose
    --url <url>
    --data '<data>'

Example sending CalDAV request to SOGo Groupware server

Show capabilities:

curl --request OPTIONS --insecure --user wilbert --verbose --url https://wilbertvolkers.dyndns.org/SOGo/dav/wilbert/Calendar/personal

Add an event:

  • id: event-1234,
  • startdate: 2013-09-01
  • starttime: 19:45
  • title: 'Test New Event'
curl --basic --user 'wilbert' \
    --request PUT --header 'Content-Type: text/calendar; charset="UTF-8"' \
    --insecure --url 'https://wilbertvolkers.dyndns.org/SOGo/dav/wilbert/Calendar/personal/event-1234.ics' \
    --data '
BEGIN:VCALENDAR
PRODID:-//Inverse inc./SOGo 2.0.7//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Europe/Amsterdam
X-LIC-LOCATION:Europe/Amsterdam
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:4F9F-52237C80-1-1FDBAB80
SUMMARY:Test New Event
LOCATION:At home
CLASS:PUBLIC
CREATED:20130901T174221Z
DTSTAMP:20130901T174221Z
LAST-MODIFIED:20130901T174221Z
DTSTART;TZID=Europe/Amsterdam:20130901T194500
DTEND;TZID=Europe/Amsterdam:20130901T204500
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR'