php - submit data to page

Shadow2531

[H]ard|Gawd
Joined
Jun 13, 2003
Messages
1,670
What's the proper way to submit info to a page with php so that it's like submitting from a form.

e.g.

header("Location: http://site.com/test/login.php?signin=$this&passkey=$that")

I think I have to use fsockopen() and then fputs() etc, but the general php.net example is not helping.

I tried just encoding it with urlencode, but that didn't work correctly with Location:

Thanks
 
Hmm.... I hope I have this right....

When I read your poorly written post... I have the idea that you are wanting to use $_GET .

... You could write in your page : $_GET[signin] and $_GET[passkey] .

Of course... I'm probably wrong.

Mandane
 
I think he wants to access the data on the other side via $_POST, which is a trick I'd love to learn.
 
Basically I want to remote login to an asp page from php (POST).

I can do this now with the location header.

However, I think I need to send it as application/x-www-form-urlencoded like forms do. From what I've read, I need to use fsockopen or curl. I am asking for an fsockenopen example because the php.net's example is not helping.

Thanks.
 
Here's an example of what I'm trying to do. It obviously doesn't work because I don't have it setup correctly.

PHP:
if ($_SERVER['HTTP_REFERER'] == "http://blablabla.com/login.php") {
    $other_site = "http://anothersite.com";
    $signin_vars = 
        "/loginscripts/a_login_page.asp?Signin=".
        $signin_username.
        "&Password=".
        $signin_pass.
        "&js=True";
    $vars_cl = strlen($signin_vars);
    $ReqHeader = 
        "POST $URI HTTP/1.1\n"."Host:$other_site\n".
        "Content-Type:application/x-www-form-urlencoded\n".
        "Content-Length: $vars_cl\n\n".
        "$signin_vars\n"; 
    $signin_socket = fsockopen($other_site, 80, &$errno, &$errstr); 
    fputs($signin_socket, $ReqHeader); 
    fclose($signin_socket);
    break; // I need it to stop so the rest of the code doesn't execute.
}
 
Back
Top