I found 2 different scripts online and they both sort of worked but not completely.
PHP Code:
<?php
# $host includes host and path and filename
# ex: "myserver.com/this/is/path/to/file.php"
# $query is the POST query data
# ex: "a=thisstring&number=46&string=thatstring
# $others is any extra headers you want to send
# ex: "Accept-Encoding: compress, gzip\r\n"
function post($host,$query,$others=''){
$path=explode('/',$host);
$host=$path[0];
unset($path[0]);
$path='/'.(implode('/',$path));
$post="POST $path HTTP/1.1\r\nHost: $host\r\nContent-type: application/x-www-form-urlencoded\r\n${others}User-Agent: Mozilla 4.0\r\nContent-length: ".strlen($query)."\r\nConnection: close\r\n\r\n$query";
$h=fsockopen($host,80);
fwrite($h,$post);
for($a=0,$r='';!$a;){
$b=fread($h,8192);
$r.=$b;
$a=(($b=='')?1:0);
}
fclose($h);
return $r;
}
echo post("www.domain.org/page.php","param=1");
?>
For some reason, both of the scripts return results with funky numbers and letters in them.
Here is a piece of the result with the weird letters/numbers in it:
15
<option value='blah'
f
>blah</option>
14
<option value='blah2'
e
>blah2</option>
13
<option value='blah3'
d
>blah3</option>
15
<option value='blah4'
f
>blah4</option>
18
The things in bold aren't supposed to be there and I don't see them when I try to access the page through browsers, only when I do it with the script.
so confused....
Bookmarks