Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

POSTing to url

 [1/5] from: jblake::arsenaldigital::com at: 12-Jul-2007 14:27


Ok. What am I doing wrong? I'm reading in a csv and using the data to post to a url. The url is a php script that opens a ticket in our ticketing system. I can read the file info. When I post, the response is that it's not seeing all of the items needed. I'm doing; result: read/custom http://x.x.x.x/api/portal.php reduce ['post mold host ip category customer] host, ip, category and customer are all populated from the csv. I tried putting ['post mold "?&host="host "&ip="ip ...snip..] but that didn't work either. I feel like I'm hitting all around it but not quite there yet. Thanks John

 [2/5] from: dhsunanda:gmai:l at: 12-Jul-2007 3:27


John:
> result: read/custom http://x.x.x.x/api/portal.php reduce ['post mold > host ip category customer]
I would have thought this would give you the right format for the URL (subject to the keywords being right) (It's the way I do it, anyway): target: http:... parameters: rejoin ["host=" host "&ip=" ip "&cat=" category ....] read/custom target compose [POST (parameters)] If that fails, see what you get with: read join target ["?" parameters] You may need to escape some of the parameter values -- eg if your customer names contain "=", "&" or space. Is it possible you are being returned a HTML page that you need to parse for usable content? Sunanda

 [3/5] from: jblake:arsenaldigital at: 12-Jul-2007 15:26


That's for the response. The page is returning the error designed for when it doesn't get the items. Here's the php code; ////////////////////////////// // Check for required field(s) if(!isset($_POST['host'], $_POST['ip'], $_POST['category'], $_POST['subject'], $_POST['site'], $_POST['customer'], $_POST['contact'], $_ POST['body'])) { echo <prov-req-response><transtatus>12112</transtatus><ticketnum>-1</ticketn um></prov-req-response> ; die(); // CATCH ERROR } ///////////////////// When I print my result; I see the "-1" line which is the error line. Let me try your suggestions. Thanks John

 [4/5] from: Tom:Conlin::gmail at: 12-Jul-2007 12:41


Hi John, there are url-encode.r functions floating about that might help. in extreme cases when you *know* your request is valid and still do not get the expected response I have had to (temporarily) disable rebols auto redirects ... here is a snippit ... ;; un-redirect monkey-patch inspired by Ryan Cole o: second get in system/schemes/http/handler 'open ora: find/tail o to-set-word 'response-actions poke first ora 16 pick first ora 4 page: read/custom http://www.xyz.com/RC2/engine/sqlGenerator_xyzCom.asp compose/deep[POST (req) [Cookie: (cookie)]] ;; un-un-redirect monkey-patch poke first ora 16 pick first ora 14 .... John Blake wrote:

 [5/5] from: jblake::arsenaldigital::com at: 12-Jul-2007 18:13


Thanks for the help Sunanda. Posting to users for searches Here's what I did to get it working. parameters: rejoin ["product=" prod "&host=" host "&ip=" ip &categorycat "&subject=" subj "&site=" site "&customer=" cust "&contact=" contact &body data "&"] result: read/custom target reduce ['post parameters] print result When I had the ticketing sys guy insert some code so I could see what it was receiving; I got that it was only seeing "product=<br" Then I was able to figure it out. John