POST request

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
jurriemcflurrie
Forum Commoner
Posts: 61
Joined: Wed Jul 06, 2005 7:14 am
Location: Den Haag, the Netherlands

POST request

Post by jurriemcflurrie »

We have an secured internet connection at the business i work, so we can't request pr0n etc.

Now I'ts not that I'm a pervert or something :) but I want to get round that security.

And I did. I made a prefetch script and uploaded it to an allowed server. The script changes all links, images, etc to the prefetch script so those are displayed also.

Problem is those post forms. Is there a way to send a post request via php?

Thanks in advance!
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Not sure if this is a taboo subject or not.. but my guess would be cURL.
User avatar
jurriemcflurrie
Forum Commoner
Posts: 61
Joined: Wed Jul 06, 2005 7:14 am
Location: Den Haag, the Netherlands

Post by jurriemcflurrie »

Thanks for the reply. I have no control over the sever wich the files are on, and curl is not supported :( Any other adeas?


But why would it be a taboo subject? It's not that I actually gonna use it :) I just want to see if I can do it. Tons of pr0n at home so no need for here at work :P
I heard that my boss spend a whole lot of money on the system that blocks unwanted pages. So I thought let's see what I can do. In 2 minutes I got around the system so I'm curious what the possabilities exactly are. Just for fun :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

fsockopen() is the old fashioned way.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

I just thought that bypassing security measures might be looked upon as taboo, but I suppose it's the use that is taboo, not the application itself.. just like guns :P
User avatar
zeveck
Forum Newbie
Posts: 15
Joined: Mon Oct 17, 2005 7:23 pm
Location: Mountain View, CA

Post by zeveck »

Using fsockopen() looks like overkill.

I mean, doing a redirect is easy, and can include GET data since that is in the URL.

Is there a similarly easy way to redirect to a given URL with programmatically appended POST data?

Or, barring that, simple directions on how to use fsockopen() to do a POST rather than the generic link of using it to literally open a socket, build the statement manually, etc.??
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

zeveck wrote:Using fsockopen() looks like overkill.

I mean, doing a redirect is easy, and can include GET data since that is in the URL.

Is there a similarly easy way to redirect to a given URL with programmatically appended POST data?

Or, barring that, simple directions on how to use fsockopen() to do a POST rather than the generic link of using it to literally open a socket, build the statement manually, etc.??
Sending POST with fsockopen isn't hard really. HTTP headers are very very simple ;) cURL makes it easier granted. POST is not URL based so it cannot be done via URL no :)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Set up a proxy server!
User avatar
zeveck
Forum Newbie
Posts: 15
Joined: Mon Oct 17, 2005 7:23 pm
Location: Mountain View, CA

Post by zeveck »

wha?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

I assume they're doing filtering on a site blacklist basis. These connections have to go through the network, so they can be bypassed. However, a proxy server allows you to connect to only one IP: the IP of the proxy server, which then makes connections to the blocked IPs without restriction. It's sorta like those open proxies you can find on the web, only it's faster and more secure.
User avatar
zeveck
Forum Newbie
Posts: 15
Joined: Mon Oct 17, 2005 7:23 pm
Location: Mountain View, CA

Post by zeveck »

Ah. I thought you were commenting on the PHP POST issue as opposed to the avoiding work filters issue.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

You may want to search for a tunnel... Nowadays there are tunnels over http, dns, ... This way you're not limited to surfing only...
User avatar
jurriemcflurrie
Forum Commoner
Posts: 61
Joined: Wed Jul 06, 2005 7:14 am
Location: Den Haag, the Netherlands

Post by jurriemcflurrie »

No I just want to do it with php... Next week I'll have a look at it again. It's almost weekend!! :lol: :D :twisted: Thanks for all the replies!
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

you have to download these following classes which would help you make POST and GET messages.
PEAR class
URL class
Socket class
Request class
basically you would have to use Request class and you have to include this in your script file and the other files will be included in Request.php. If you see the Request.php file , you will see include paths and make sure you put the other files in the directories as specified in Request.php include statements...

example usage:

Code: Select all

include('../Request.php');
$req = &new HTTP_Request("http://somehost.com/login.php");
$req->addPostData("txtUserName", "username", false);
$req->addPostData("txtPassword", "password", false);
$req->addPostData("subAuthentication", "submit", false);
$req->sendRequest(true);
print_r($req->getResponseHeader());
print_r($req->getResponseCookies());
echo $req->getResponseBody();
User avatar
zeveck
Forum Newbie
Posts: 15
Joined: Mon Oct 17, 2005 7:23 pm
Location: Mountain View, CA

Post by zeveck »

Download from where? Are these standard parts of PHP? I mean, I know PEAR is, but what of the others?
Post Reply