PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Socket create with ssl server
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Socket create with ssl server

Réponse
 
LinkBack Outils de la discussion
Vieux 10/04/2008, 23h20   #1
Alan Willsher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Socket create with ssl server

Hi how do you use socket_create with an ssl server

ie I would do something like

$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($sock, $sourceip);
socket_connect($sock, 'server.com', 2043);

but if I do

$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($sock, $sourceip);
socket_connect($sock, 'ssl://server.com', 2043);

I get Warning: socket_connect(): Host lookup failed [-10001]: Unknown host

Where do I need to add the ssl://

  Réponse avec citation
Vieux 11/04/2008, 01h15   #2
Nirmalya Lahiri
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Socket create with ssl server

--- Alan Willsher <al.willsher@googlemail.com> wrote:

> Hi how do you use socket_create with an ssl server
>
> ie I would do something like
>
> $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
> socket_bind($sock, $sourceip);
> socket_connect($sock, 'server.com', 2043);
>
> but if I do
>
> $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
> socket_bind($sock, $sourceip);
> socket_connect($sock, 'ssl://server.com', 2043);
>
> I get Warning: socket_connect(): Host lookup failed [-10001]:
> Unknown host
>
> Where do I need to add the ssl://
>


Hi,
before test your sample program, please check the name
"ssl://server.com" from any DNS server that, the name is really
present in internet or not. Your problem is basically name resolution
error from DNS server. To check the name, apply "host" command from
unix/linux terminal.

Another point is...as I know the url of ssl encripted page starts
with "https://" not with "ssl://"...!!!


---
Nirmalya Lahiri
[+91-9433113536]

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
  Réponse avec citation
Vieux 11/04/2008, 04h05   #3
Greg Bowser
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Socket create with ssl server

The sockets extension is a much "lower" level interface to sockets
than the fsockets/stream_ functions in PHP.

Unlike with the aforementioned, with the sockets extension, you can't
just expect to magically get an ssl connection by using "ssl://".

Your problem is that the sockets extension has no idea what you mean
by "ssl://"; and since "ssl://foo" is clearly not a valid domain name,
resolution fails.

Short Answer: use fsockets if you need SSL
  Réponse avec citation
Vieux 19/04/2008, 03h45   #4
Alan Willsher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Socket create with ssl server

Is it possible to do this with CURL instead of the socket functions

$bindip = 'xx.xx.xx.xx';
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($sock, $bindip);
socket_connect($sock, 'ssl://epp.server.com', 80);

ie bind an IP and connect to an ssl:// address

Trying to connect via the IP instead of ssl://epp.server.com fails.

Thanks


On Fri, Apr 11, 2008 at 12:15 AM, Nirmalya Lahiri <nirmalyalahiri@yahoo.com>
wrote:

> --- Alan Willsher <al.willsher@googlemail.com> wrote:
>
> > Hi how do you use socket_create with an ssl server
> >
> > ie I would do something like
> >
> > $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
> > socket_bind($sock, $sourceip);
> > socket_connect($sock, 'server.com', 2043);
> >
> > but if I do
> >
> > $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
> > socket_bind($sock, $sourceip);
> > socket_connect($sock, 'ssl://server.com', 2043);
> >
> > I get Warning: socket_connect(): Host lookup failed [-10001]:
> > Unknown host
> >
> > Where do I need to add the ssl://
> >

>
> Hi,
> before test your sample program, please check the name
> "ssl://server.com" from any DNS server that, the name is really
> present in internet or not. Your problem is basically name resolution
> error from DNS server. To check the name, apply "host" command from
> unix/linux terminal.
>
> Another point is...as I know the url of ssl encripted page starts
> with "https://" not with "ssl://"...!!!
>
>
> ---
> Nirmalya Lahiri
> [+91-9433113536]
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h53.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14401 seconds with 12 queries