Page 1 of 1
Tool(s) to retrieve web POST data?
Posted: Thu Sep 04, 2008 4:20 pm
by kawasaki
Hey,
Since this is a Web question, that is relevant to PB (I believe) since I am working with PureBasic and POST Data.
Is there any tools that anyone can think of that can get the POST data that is sent back to the server?
Ideally a tool which sits between a Web control, and the Internet that parses the data you (or in this case I) sent back and lists the POST data?
(sorry if this isn't seen as an acceptable request for this forum.)
Thanks,
Mike
Posted: Thu Sep 04, 2008 4:51 pm
by Mistrel
I haven't used it with PureBasic before but you may be able to use libcurl to read/write the post data.
http://curl.haxx.se/
Here is a link to an example done in PHP:
http://www.askapache.com/htaccess/sendi ... -curl.html
Posted: Thu Sep 04, 2008 5:14 pm
by kawasaki
Hi Mistrel,
I have looked at LibCurl prior to posting on here, but unfortunately it doesn't meet my requirement.
POST (HTTP)
It's easy to post data using curl. This is done using the -d <data>
option. The post data must be urlencoded.
Post a simple "name" and "phone" guestbook.
curl -d "name=Rafael%20Sagula&phone=3320780" \
http://www.where.com/guest.cgi
- LibCurl Documentation
It appears it only aids sending of POST data, where as I ideally need to see what POST data is sent from a browser to the server.
So if I am browsing say this forum, and I click Submit on entering a post, I need something that shows me what POST data is being sent from my browser to the forum server.
Thanks all the same,
Mike
Posted: Thu Sep 04, 2008 6:10 pm
by Joakim Christiansen
kawasaki wrote:So if I am browsing say this forum, and I click Submit on entering a post, I need something that shows me what POST data is being sent from my browser to the forum server.
No problem at all, just inspect the HTML code, then you'll know exactly what the browser will send and then you can emulate this in your software.
I did this once when I made a imageshack uploader in PB.
But if you really want to actually capture the data going through your network wires, then I have no idea about that.
Let me know if you find some browser plugin that does this btw, would be nice to have.
Here is some program I made for automatically finding HTML forms:
Code: Select all
Procedure.s HttpGet(Server$,Path$,Cookies$="",Download=#True) ;shitty one for testing
Protected Request$,Result$,BytesRead,BufferLength=40000,*Buffer = AllocateMemory(BufferLength)
Protected ServerID = OpenNetworkConnection(Server$,80) ;443 for https
If ServerID
Request$ = "GET "+Path$+" HTTP/1.1"+#CRLF$
Request$ + "Host: "+Server$+#CRLF$
If Cookies$
Request$ + "Cookie: "+Cookies$+#CRLF$
EndIf
Request$ + "User-Agent: "+UAgent$+#CRLF$+#CRLF$
SendNetworkData(ServerID,@Request$,Len(Request$));+1)
If Download
J01:
Repeat
BytesRead = ReceiveNetworkData(ServerID,*Buffer,BufferLength)
Result$ + PeekS(*Buffer,BytesRead)
Until BytesRead < BufferLength
Delay(100)
If NetworkClientEvent(ServerID) = #PB_NetworkEvent_Data
Goto J01
EndIf
EndIf
CloseNetworkConnection(ServerID)
EndIf
FreeMemory(*Buffer)
ProcedureReturn Result$
EndProcedure
InitNetwork()
Result$ = HttpGet("imageshack.us","/")
;Debug Result$
For i=1 To CountString(Result$,#LF$)+1
String$ = StringField(Result$,i,#LF$)
If FindString(LCase(String$),"<form",1)
Debug "FORM START ##############################################"
Debug String$
ElseIf FindString(LCase(String$),"<input",1)
Debug String$
ElseIf FindString(LCase(String$),"<textarea",1)
Debug String$
ElseIf FindString(LCase(String$),"<select",1)
Debug String$
ElseIf FindString(LCase(String$),"<option",1)
Debug String$
ElseIf FindString(LCase(String$),"<button",1)
Debug String$
ElseIf FindString(LCase(String$),"</form>",1)
Debug "FORM END ################################################"
Debug "": Debug ""
EndIf
Next
Posted: Thu Sep 04, 2008 6:19 pm
by kawasaki
First of all the website I am trying to post data to is
http://www.sendsmsnow.com/
My goal is to write a client for it so that it checks for any new SMS' every specified minutes, or seconds.
You do have to log into it (hence why I am trying to sort out the POST problem).
But I can't seem to work around doing this, I have sent a post string of
"uname="+username.s+"&upass="+password.s
But for some reason I keep getting back errors.
Here is the chunk of the HTML code that is dealing with the logging in;
Code: Select all
<form action="index.php" method="post">
<tr>
<td class="inptext"><b>User name</b></td>
<td><input name="uname" size="10"></td>
</tr>
<tr>
<td class="inptext"><b>Password</b></td>
<td><input name="upass" size="10" type="password"></td>
</tr>
<tr>
<td align="center" colspan="2">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="right"><input name="urem" type="checkbox" value="remember"></td>
<td class="inptext">Remember me</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="image" border="0" src="images/submit.gif">
</td>
</tr>
<tr>
<td colspan="2" align="center"><a class="TopNav" href="http://www.sendsmsnow.com/forgetpass.php">Forgot password?</a></td>
</tr>
</form>
Posted: Thu Sep 04, 2008 6:30 pm
by Joakim Christiansen
Hmm, I'm not sure if I really want to start messing around with this myself at this moment.
But does the username contain spaces or weird characters? If so maybe URLEncoder() will help.
And if you get this working and login, then you must usually capture the php session id cookie too and use it in your other post or get requests to stay logged in.
I know some sites can be a pain in the ass, but I hope you get it working

But let me know if you ever find some browser plugin or something to get the post requests, that would rock.
Posted: Thu Sep 04, 2008 6:33 pm
by kawasaki
I will, rest assure it lol
Posted: Thu Sep 04, 2008 6:46 pm
by kawasaki
Well I'll be...
Found the perfect tool! (lmao).
The program is called HTTP Analyzer and it can either be ran stand alone, or be embedded into Microsoft's Internet Explorer. (A screenshot attached.)
HTTP Analyzer is a utility that allows you to capture HTTP/HTTPS traffic in real-time. It can trace and display wide range of information, including Header, Content, Cookies, Query Strings, Post data, Request and Response Stream, redirection URLs and more.
- From the description.
It does cost $75 (for the Internet Explorer Add-on Edition (Non Commercial)), but anyone who is often doing such tasks, may find this an invaluable tool.
The website is:
http://www.ieinspector.com/httpanalyzer/index.html
Screenshot;
Sorry for the post lol, and I hope someone else with this problem will stumble across this.
Mike
Posted: Fri Sep 05, 2008 4:27 am
by Rescator
Here is a free plugin for Firefox that does what you probably want as well.
http://livehttpheaders.mozdev.org/
Posted: Tue Sep 23, 2008 1:18 pm
by eddy
@Joakim Christiansen
Nice...

I'll try your code.
I searched an HTTPS Get example.