Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How PHP use Openssl ? 1

Status
Not open for further replies.

neltan

Programmer
Nov 4, 2002
82
AU
Hi PHP Experts,
I've install Openssl on my apache server.

How can PHP make use of Openssl?
e.g. submiting html form data &
display the form data to browser

And what's other usage of Openssl on server? and how?

Best Regards,
neltan - newbaby on ssl
 
You're gonna have to use PHP's curl family of functions. Although PHP's fopen() function can open an HTTP web page, the current version cannot open HTTPS web pages.

Take a look at my FAQ on the subject: faq434-2502 ______________________________________________________________________
TANSTAAFL!
 
Thanks! sleipnir214.

Why I need curl?
Openssl is not enough for making ssl?
What's difference between them?

neltan
 
OpenSSL is merely an open-source implementation of the encryption libraries necessary to support SSL and other encryption functions. But in order to use OpenSSL with PHP, you need some kind of interface to that library. CURL is one interface.

PHP supports HTTPS through it's fopen() function starting with 4.3.0. However, that version is currently pre-release. ______________________________________________________________________
TANSTAAFL!
 
I'm now understand how to use curl. Thank you.

Is "curl" only used to force browser to connect server in ssl?

If somebody type the url " directly, he can also make ssl connection. That means I can use ssl without using "curl" in php, Right?
 
I found that I can use ssl by these code already.
Why do I need curl ?

<?php
// redirect.php
header (&quot;Location: ?>
 
That makes the browser connect to the SSL site, not the server. For the server to connect to a SSL site, you have to use CURL. //Daniel
 
daniel,

could you elaborate further about the server vs browser connection to SSL site...I am still a little vague on the differences.

Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Maybe I can help.

You have two web servers, &quot;A&quot; and &quot;B&quot;, and a web browser which is pointing to a PHP script on &quot;A&quot;. The script on &quot;A&quot; needs to get data from &quot;B&quot; to the browser.

There are two ways to accomplish this. The script on &quot;A&quot; can use header(&quot;Location:...&quot;) to redirect the browser to the appropriate place on &quot;B&quot;, and the browser will retrieve the information from there.

But you can also have &quot;A&quot; fetch the information itself from &quot;B&quot; then pass the data to the browser without redirection. The script on &quot;A&quot; can act as a proxy to the information on &quot;B&quot;.

An example of this is e-commerce credit-card processing systems. I know about Authorize.net, so I'll talk about them. You can upload pages to Authorize.net's servers, and when your site needs to charge, redirect the browser to your pages on Authorize.net's servers. This does, however, leave a trail through the browser's history, and sometimes it's hard to get the look and feel consistent.

You can also have your script collect the card data, pass the card data to Authorize.net's servers directly, receive the authorization information from the server, and display it to the browser using server-to-server HTTPS. All from within a single script. Your customer has never left your site, you can easily keep look-and-feel consistent, and it keeps users from knowing which processing system you use. ______________________________________________________________________
TANSTAAFL!
 
That means there are 2 method to connect a SSL site.

1. Redirect (like code above)
2. Keep browser stay at some url and we will connect the SSL site through a tunnel called &quot;curl&quot;. Then, we can keep all the things.

I think that curl is just like a command line browser (+ftp and more). And it's able to perform method 2.

* In PHP-curl, I can get html when using but it fails when using https://
 
neltan,

CURL does exists as a command-line app, separate from PHP. PHP also has a family of CURL functions ( which can be used if and only if CURL support is compiled into PHP. ______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top