|
-
Jan 21st, 2005, 03:12 PM
#1
Thread Starter
Addicted Member
-
Jan 22nd, 2005, 05:11 AM
#2
Re: Mailing please help!
You can't put the values in the query string becuase the form is submitted via the HTTP post method. It is possible to connect to the server and send a raw HTTP POST request to the page in PHP though.
It involves the following steps:
- Establish a connection to the host on port 80 using the fsockopen() function.
- Use the urlencode() function to encode the values of all the variables you are sending via post and construct a string which looks something like this:
Code:
name=encoded%20value1&addreess=11%20foster%20road&surname=smith
- Find the length of that string using the strlen() function.
- Send an HTTP post request using PHP's file I/O functions to the server which will look something like this:
Code:
POST /path/topage.php HTTP/1.0
Content-Length: 63
Content-Type: application/x-www-form-urlencoded
name=encoded%20value1&addreess=11%20foster%20road&surname=smith
- Read back the reponse from the server which should either be:
Both of these indicate the server recieved the data success fully. The 302 response will come with a location header telling you where to go next and the 200 reposne will come with the page directly after the headers.
-
Jan 24th, 2005, 01:05 AM
#3
Lively Member
Re: Mailing please help!
This should work, its not tested tho...
Code:
$recipient = $_GET[st_email] ;
$subject = $_GET[sub_line] ;
$msg = "Message:". $_GET[message] ."\n\n";
$mailheaders = "Sender Name: Your_Name \n";
$mailheaders .= "Reply-To: Your_Emial_@_address.com \n\n";
mail($recipient, $subject, $msg, $mailheaders);
The url would look like...
[email protected]&sub_line=Subject_Line&message=Body_of_the_message
There would be no form to fille out, the info would be passed straight to the php file from the url.
_
~ What was once an opinion, became a fact, to be later proven wrong... ~
-
Jan 24th, 2005, 03:34 AM
#4
Re: Mailing please help!
Good example Misspell but did you look at the link he gave? I think he wants to use a PHP script to post the data to that server. As it only uses the HTTP post method he would need to do it manually. But maybe a misinterpreted. 
** Waits for Tommy101 to get back ....
-
Jan 24th, 2005, 04:29 AM
#5
Lively Member
Re: Mailing please help!
Yea i checked out his link, but when he says "so i actually don't have to view the page, just type something in the address bar" i thouhgt he was trying to get around a form lay-out.
Personaly, i do not see how that would be any faster, if anything more a pain and restricting (typing in a url field), but we're all differnet 
_
~ What was once an opinion, became a fact, to be later proven wrong... ~
-
Jan 24th, 2005, 04:49 AM
#6
Re: Mailing please help!
 Originally Posted by Misspell
Yea i checked out his link, but when he says "so i actually don't have to view the page, just type something in the address bar" i thouhgt he was trying to get around a form lay-out.
Personaly, i do not see how that would be any faster, if anything more a pain and restricting (typing in a url field), but we're all differnet
_
In PHP you can use the fopen() function to open a web page and read it in to your script similar to what the browser does. If you use a form which sends its data via the GAT method then it is pretty simple as all the form variables and their values are appended to the query string.
The POST method which the form uses that Tommy pointed to is different, in that the data is sent in the main body of the HTTP request and not in the query string.
The reason he would use it is to automatically send the data to the server cia his PHP script. I should point out that this does violate the usage policies of some sites and may actually be illegal, so it is worth finding out if you can do it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|