filling out forms through proxies with php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zelnaga

    filling out forms through proxies with php

    i'm connecting to the internet via a proxy, and am having problems
    filling out forms... below is the code i have, and below that is the
    http request i am trying to make it look like. they look the same to
    me, but it isn't working, so i guess they aren't...

    $proxy = fsockopen("tcp://someaddresshere ", 80, $errno,
    $errstr);
    $temp = "somethingelse= blablabla";
    fputs($proxy,"G ET somesite HTTP/1.0\r\n");
    fputs($proxy,"A ccept: */*\r\n");
    fputs($proxy,"R eferer: http://someothersitesi te\r\n");
    fputs($proxy,"C ontent-Type:
    application/x-www-form-urlencoded\r\n" );
    fputs($proxy,"C ontent-Length: " . strlen($temp) . "\r\n\r\n") ;
    fputs($proxy,$t emp . "\r\n");
    while (!feof($proxy))
    print fgets($proxy);
    fclose($proxy);

    with that script, i don't get anything. however, with this http
    request, from opera 7.10, i do:

    POST http://somesite HTTP/1.0
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera
    7.10 [en]
    Host: somesite
    Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap,
    */*;q=0.1
    Accept-Language: en;q=1.0
    Accept-Charset: windows-1252, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1
    Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
    Referer: http://someothersite
    Proxy-Connection: close
    Content-type: application/x-www-form-urlencoded
    Content-length: xx

    somethingelse=b lablablaHTTP/1.1 200 OK
    Via: 1.1 DELTANS
    Connection: close
    Content-Type: text/html
    Date: Fri, 20 Jun 2003 17:54:37 GMT
    Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12
    OpenSSL/0.9.6b DAV/1.0.2 PHP/4.1.2 mod_perl/1.26
    X-Powered-By: PHP/4.1.2
    Set-Cookie: PHPSESSID=6c6ba ebea48c1ee4ad56 2d7fef3a46a4; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
    pre-check=0
    Pragma: no-cache
    Set-Cookie: something
    Set-Cookie: something

    now the last part of the http request isn't a request persay, but
    whatever, hehe :)

    anyways... any ideas as to what i'm doing wrong? thanks! :)
Working...