Re: Re: POST without form
| From: | Daniel Dickey | Date: | Tue, 16 Oct 2001 02:45:31 +0000 |
| Subject: | Re: Re: POST without form | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71164@lists.php.net to get a copy of this message | ||
Thanks to everyone for their help so far. Just a few more questions.
What will I need to do to make this simple post method (shown below written
by Andrus) work with SSL? Do I just change the port number and protocol?
Will I have to use cURL? If I do then how can I tell if my host supports
cURL? Will it always show up somewhere in PHPInfo?
I am trying to get PayPal Instant Payment Notification (IPN) to work with
PHP. I have done a lot of searching and a lot of people are trying to do the
same thing. I just haven't seen a straight answer yet. I have the PERL and
ASP/VBScript samples but no PHP. (Let me know if you want to see the sample
code.
Thanks again for your help. You guys are great.
"Reductor" <sjdtmv@tpg.com.au> wrote in message
news:00d801c152ee$7e1fec80$eb00a8c0@mum...
> you must put to newlines(\n\n) at the end of it all
> ----- Original Message -----
> From: "_lallous" <elias_bachaalany@yahoo.com>
> To: <php-general@lists.php.net>
> Sent: Friday, October 12, 2001 5:59 PM
> Subject: [PHP] Re: POST without form
>
>
> > // simple post method
> > // version 1.0 by Andrus (andrus@vnet.ee)
> >
> > // Disclaimer:
> > // everyone can change or use this code however and wherever they want
;)
> >
> >
> >
> > // send out "browser" headers
> > function send_headers ($fp) {
> > fputs ($fp, "Accept: */*\n");
> > fputs ($fp, "Accept-Language: en\n");
> > fputs ($fp, "Connection: Keep-Alive\n");
> > fputs ($fp, "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows
> > 98)\n");
> > }
> >
> > // post data and return reply
> > function post_data ($host, $url, $data) {
> > $fp = @fsockopen ($host, 80, $errno, $errstr, 120);
> > $ret = "";
> > if (strncasecmp ($url,
> > "http://", 7) == 0) $url = substr
> > ($url, 7);
> > $p = strpos ($url, '/');
> > if (empty ($p)) {
> > $req = "/";
> > } else {
> > $req = substr ($url, $p);
> > }
> > if ($fp) {
> > fputs ($fp, "POST $req HTTP/1.0\n");
> > send_headers ($fp);
> > fputs ($fp, "Content-type: application/x-www-form-urlencoded\n");
> > $out = "";
> > while (list ($k, $v) = each ($data)) {
> > if(strlen($out) != 0) $out .= "&";
> > $out .= rawurlencode($k). "=" .rawurlencode($v);
> > }
> > $out = trim ($out);
> > fputs ($fp, "Content-length: ".strlen($out)."\n\n");
> > fputs ($fp, "$out");
> > fputs ($fp, "\n");
> > while(!feof($fp)){
> > $ret .= fgets($fp,128);
> > }
> > fclose ($fp);
> > }
> > return $ret;
> > }
> > // example how to use:
> >
> > // following code will post variables "login" and "pass" to server
> > "www.something.com" script "/submit.php"
> > $reply = post_data ("www.something.com", "/submit.php", array
> > ("login"
=>
> > $username, "pass" => $password));
> >
> >
> > "Daniel Dickey" <daniel_dickey@hotmail.com> wrote in message
> > news:20011011160148.24821.qmail@pb1.pair.com...
> > > How do I send a POST without using a form?
> > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>