#native_company# #native_desc#
#native_cta#

Creating a PHP Script for Web Mail Posting and Notification Page 3

By Jochen Staerk
on May 17, 2004

You could now parse the subject and the header-info, but the author
likes to keep it general. My script collects the standard input and posts it to
a URL such as it would be entered in a regular web form. In order to have it
work for every application, we are not parsing. You could enhance the script
so that every entry to the email header is being posted, such as it was an
imaginary hidden field in a web formular. Doing this, you would make
everything more complicated and you would specialize your application to
email only.
POSTING OF THE CONTENT
There is a problem to run an HTTP-POST with PHP. PHP does not support
that in the implemented scope of languate. The script from “[email protected]
(on nf.wh3rd.net/projects/http.inc/) emulates exactly this function, however.
It looks something like this:

<?php

$headers 
"POST &lt;URL&gt; HTTP/1.1rnConnection:

Keep-AlivernUser-Agent: &lt;some faked user agent&gt;rnPragma:

no-cachernCache-control: no-cachernAccept: */*rnAccept-Language:

de,en,en-aurnHost: &lt;server&gt;rnContent-Type:

application/x-www-form-urlencodedrnContent-Length: &lt;length of  

urlencoded

length&gt;rnrn"
;

$fp fsockopen($server$port$errno$errstr);

if (!
$fp

{

    return 
false;

}

fputs($fp$headers);

fputs($fp$urlencoded);

$res="";

while (!
feof($fp)) $res.=fgets($fp1024);

// what the Server shows is now in $res

fclose($fp);

?>