Sending a https Request to Another Server.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mazzy_b
Forum Newbie
Posts: 3
Joined: Sat May 22, 2010 2:10 am

Sending a https Request to Another Server.

Post by mazzy_b »

Please any one provide me the php code for Sending a https Request to Another Server.
Regards
Munish Bhargav
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: Sending a https Request to Another Server.

Post by Apollo »

Look at the examples in the PHP manual for the fsockopen function.
mazzy_b
Forum Newbie
Posts: 3
Joined: Sat May 22, 2010 2:10 am

Re: Sending a https Request to Another Server.

Post by mazzy_b »

Dear Apollo thanks for reply.
Dear I just have very few knowledge of PHP. and the post you provided is very long. It if very difficult to understand. Could you please provide me the actual code here and explain me a bit.
actually my requirement is exactly fulfill by this post

Thanks and Regards
Munish Bhargav
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: Sending a https Request to Another Server.

Post by Apollo »

The code is exactly there, see "Example #1 fsockopen() Example".

If you really stuff like this, you're really better off by doing some study/research yourself to gain a better understanding of what's actually going on.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Sending a https Request to Another Server.

Post by John Cartwright »

cURL is much more suitable than socket protocol implementations.

Code: Select all

$ch = curl_init('https://some_secure_url.com');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$return = curl_exec($ch); //contains response to HTTPS call
mazzy_b
Forum Newbie
Posts: 3
Joined: Sat May 22, 2010 2:10 am

Re: Sending a https Request to Another Server.

Post by mazzy_b »

Thanks John Cartwright for reply,
i also need to send some data along with https request. would you provide me the code how would I achieve it.
Regards
Munish
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Sending a https Request to Another Server.

Post by Jonah Bron »

Post Reply