473,804 Members | 3,138 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fsockopen PHP5 missing 6th argument (context)

I've noticed that fsockopen (as of PHP 5) no longer accepts context.
How can I make an SSL connection (requiring a client cert) without
using curl?

Nov 22 '05 #1
1 5166
I've found the answer!

$certFile = './yourcert.pem';
$passPhrase = 'yourpassphrase ';

$context = stream_context_ create();
$result = stream_context_ set_option($con text, 'ssl', 'local_cert',
$certFile);
if($passPhrase)
$result = stream_context_ set_option($con text, 'ssl', 'passphrase',
$passPhrase);
$result = stream_context_ set_option($con text, 'ssl', 'verify_peer',
false);
$result = stream_context_ set_option($con text, 'ssl', 'verify_host',
false);
$result = stream_context_ set_option($con text, 'ssl',
'allow_self_sig ned', true);

$sock = stream_socket_c lient('ssl://www.somewhere.c om:443',
&$errno,&$errst r, 60, STREAM_CLIENT_C ONNECT, $context);

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6395
by: Atarikid | last post by:
This script works fine on my redhat9 machine. I use it with Winblows PC I get an error. My site is not shown however it is a XML server accessible over simple HTTP post and get. The error is as follows: The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
1
5190
by: Gil-Dale | last post by:
Trying to make a connection via a proxy to another site using the fsockopen I can get it hitting the proxy server just can't get it through. I have user name and password to get through the proxy... but how exactly do I make it work using the fsockopen?? Cheers
2
3325
by: Colin Bell | last post by:
I'm stuck on a problem with getting data from a XML data stream. This stream is large and trying to use fsockopen to get the stream down. I've tetsed the code by telneting into the machine/port but I am getting some of the data but not all. I don't know the stream size. Code snippit below: function txrx($server, $port, $tx){
2
4058
by: Loopy | last post by:
I'm trying to write a script that will connect to an external site so that I can get access referer information in a database on another one of my sites. I got errors, so I tried to write a script that will test the three main forms of connecting externally: fsockopen, fopen and file. I wrote a simple script that connects to my own domain (http://www.kigurumi.co.uk) and to another external domain (http://www.yahoo.co.uk), I do nothing...
9
18700
by: fipaj1992 | last post by:
Hi! I have very big problem with fsockopen() function. It is very important... That's code: <?php $test = fsockopen ('chrome.pl', '8080'); ?>
69
16927
by: markarichman | last post by:
Why is Firefox complaining with this error: ------------------------------------------------------------ missing ) after argument list setTimeout('breakOut',5000); ------------------------------------------------------------ Here is the HTML that I'm producing:
0
1139
by: cypres | last post by:
I've installed a new linux fedora core 4 server with PHP5 and it had Plesk 8.0.1 as control panel (don't know if this is relevant). Everything is working fine but when I try to do a simple fsockopen I can't connect to another server. It isn't blocked by a firewall. Do you have any ideas what to check to see if it's enabled??
2
4869
by: Alex | last post by:
Hi all, I'm having a problem with fsockopen function, I'm programming with php 4.3 and need to do an HTTP POST over secure socket, ssl, here's my code: $context = stream_context_create(); $result = stream_context_set_option($context, 'ssl', 'local_cert', "/certificate/cert.pem"); $result = stream_context_set_option($context, 'ssl', 'passphrase', "passphrase");
4
3829
by: MikeofPet | last post by:
I am trying to implement FTP in a PHP script but am unable to make the connection to the remote server. The connection step times out at the fsockopen function. I am not sure if it is relevant but PHP is configured with "allow_url_fopen" ON. I am able to do an FTP connect using an FTP client and using the same host/username/password parameters. Any ideas would be appreciated. Thanks
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.