From 297d9cbf139a2a931d5f90b1e06888d1fd16c974 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Tue, 1 Nov 2011 02:41:43 +0000 Subject: Initial Commit. --- dbrtpi.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 dbrtpi.c diff --git a/dbrtpi.c b/dbrtpi.c new file mode 100644 index 0000000..dd3bed4 --- /dev/null +++ b/dbrtpi.c @@ -0,0 +1,55 @@ +/* +* dbrtpi.c +* +* Copyright (C) 2011 - Jonathan McCrohan +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +// gcc dbrtpi.c $(pkg-config --libs --cflags libcurl) + +#include +#include +#include + +#define URL "http://rtpi.dublinbus.biznetservers.com/DublinBusRTPIService.asmx" + + +int main(int argc, char *argv[]){ + + char soaprequest [1024]; + int stopid = 403; + sprintf(soaprequest,"\n\n\n\n%d\n1\n\n\n",stopid); + + struct curl_slist *header = NULL; + header = curl_slist_append(header,"Content-Type: application/soap+xml; charset=utf-8"); + header = curl_slist_append(header, "Accept: text/xml"); + + CURL *curl; + CURLcode res; + + curl = curl_easy_init(); + if(curl){ + curl_easy_setopt(curl, CURLOPT_URL, URL); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, soaprequest); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)-1); + res = curl_easy_perform(curl); + + curl_easy_cleanup(curl); + + printf("%s",res); + } +} + -- cgit v1.2.3