* * RPG SOAP web service to Search in WWW * Google Web API Search http://www.google.com/apis/ * Author: Alex Martinez * http://www.ajut400.com * * Note: to compile you need Scott Klement LIBHTTP 1.8 * download it from http://www.scottklement.com/httpapi/ * H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('LIBHTTP/HTTPAPI') D/copy libhttp/qrpglesrc,httpapi_h D cmd pr extpgm('QCMDEXC') D command 200A const D length 15P 5 const D rc s 10I 0 D msg s 52A D Query s 64A D GoogleKey s 32A D data s 80A ctdata dim(20) * c *entry plist c parm Query c parm GoogleKey c eval rc = http_url_post( c 'http://api.google.com/search/beta2' : c %addr(data) : c 1600 : c '/doGoogleSearchResponse.xml' : c 10 : c 'Mozilla/5.0 (X11; U; OS400)' : c 'text/xml' : c 'urn:GoogleSearchAction' ) c if rc <> 1 c eval msg = http_error c dsply msg c endif c callp cmd('DSPF ''/doGoogleSearchResponse.xml''' : c 200 ) c eval *inlr = *on * * Initialize SOAP document: * Set query search String * Set Google KEY API * c *inzsr begsr c eval data(8) = %trimr(data(8)) + c %trim(googlekey) + '' c eval data(9) = %trimr(data(9)) + c %trim(Query) + '' c endsr ** 0 10 true false latin1 latin1