[ale] OT: Website Input

Mike Harrison cluon at geeklabs.com
Thu Jan 24 05:39:22 EST 2013


Robert:
> I have a system I need to push a string of text through from a URL and I'm not sure how to do it.  
> If I telnet to "host.company.com 80"  I can enter some XML text into the resulting connection (no prompt is returned) 
> 
> <seqnum>1</seqnum>
> <encrypt-type>none</encrypt-type><request><method>geturiinfo</method><uid>wr_monitor</uid>
> <uri>google.com</uri></request></bcap>
> 
> This causes a service on the inside to return "200 <IP> OK".
> 
> I'm using alertsite.com for site monitoring and need to figure out how to do this through the "URL" input form.
> 
> Anyone have any ideas on how to format the URL to put the XML in?

I'm not sure exactly what you are doing, but I think it's the kind of 
thing I use curl for. Look in the html on the site form to see where it 
should post to.

A command line like:

curl  -d 
"<seqnum>1</seqnum><encrypt-type>none</encrypt-type><request><method>geturiinfo</method><uid>wr_monitor</uid><uri>google.com</uri></request></bcap>" 
http://alertsite.com/path/to/page/to/post/to.php


Or PHP code using curl might look like:

<?php
     $sendstring = 
"<seqnum>1</seqnum><encrypt-type>none</encrypt-type><request><method>geturiinfo</method><uid>wr_monitor</uid><uri>google.com</uri></request></bcap>" 
;
     $ch = curl_init();
     $url = "http://alertsite.com/path/to/form/or/api.whatever";
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
     curl_setopt($ch, CURLOPT_POST, TRUE);  #assuming it takes a form post?
     $response = curl_exec($ch);
     if (curl_errno($ch)) {
         print "Error: " . curl_error($ch);
     } else {
         curl_close($ch);
     }
     print "$response\n\n" ;
     $now2 = date("Ymd H:i:s");
     $fileout = fopen("logs/alertsite.log", "a");
     fputs($fileout, "$now2\ndata: $sendstring\nresponse: $response\n\n");
     fclose($fileout);
?>






More information about the Ale mailing list