[FX.php List] HTTPS Post
Leo R. Lundgren
leo at finalresort.org
Wed Sep 10 23:53:06 MDT 2008
POSTing form data to the server via HTTPS instead of the usual HTTP
doesn't depend on PHP in any way.
What you need to do is to make sure that in your form, you have the
action="" set to an url that is indeed a HTTPS url, such as
action="https://example.com/formhandler.php" instead of
action="http://example.com/formhandler.php".
If you are using relative urls such as action="formhandler.php", you
will need to make sure that the user have already loaded the current
page (the one with the form) from the server via HTTPS, for example
so that their address bar says "https://example.com/myform.php"
instead of "http://example.com/myform.php". If it does, then the
relative action of the form will simply use HTTPS since this is the
current "basis" for the page and nothing else is specified for the
protocol.
Regarding the PHP side, there's nothing special to do if you just
want to grab the input, you access the data via the usual $_POST
variable (see the manual under "Variables" for more information).
However, if you first want to make sure that the user posted the
stuff using HTTPS you can check the variable $_SERVER['HTTPS'] - if
it is set (and I believe it also contains the value "on" if that is
the case, at least in Apache environments) this should indicate that
the protocol used for the connection is https.
Apart from the above, you/the administrator of the webserver need to
configure it so that HTTPS is enabled for the domain/virtual host
that your site resides in.
Hope this helps.
11 sep 2008 kl. 04.07 skrev Hank Shrier:
> Hi all,
>
>
>
> I’m new to the list. I have a client who asked me the following
> question. How does one use PHP to do an https post? Does anyone
> have sample code they are willing to share? If not, can anyone
> quote me a price for such code. The desired result is to do the
> post and receive a response to the request.
>
>
>
> Please contact me back channel with any specific responses. Also,
> I am posting from Jerusalem even though I have a CA phone number.
>
>
>
>
>
> Thanks for your help.
>
>
>
> Hank Shrier
>
> +1 408-252-5418 Office
>
> +1 408-387-2111 Cell
>
> +1 408-521-1801 Fax
>
> hank at atlasinnovation.com
>
>
>
>
>
> THIS COMMUNICATION IS LEGALLY PRIVILEGED AND CONFIDENTIAL
>
> This e-mail, and any attachments hereto, is intended only for use
> by the
>
> addressee(s) named herein. If you are, or are not, the intended
> recipient
>
> of this e-mail, you are hereby notified that any dissemination,
> distribution
>
> or copying of this e-mail, and any attachments hereto, without written
>
> permission, is strictly prohibited. If you have received this email in
>
> error, please immediately notify me and permanently delete the
> original and
>
> any copy of any e-mail and any printout thereof.
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
-|
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20080911/d36a2d38/attachment-0001.html
More information about the FX.php_List
mailing list