473,729 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Warning: fsockopen() [function.fsocko pen]: unable to connect to

1 New Member
I am working on a script and i get this error

Warning: fsockopen() [function.fsocko pen]: unable to connect to https://www.alertpay.com:443 (Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?) in XXXXXXXXXXXXXX on line 84

I have contacted my host to make sure that ssl and all that is enabled he says it has been enabled and it still dont work

here is my server info

If any one see what that problem is please let me know how to maybe fix it and maybe how to get it to work here is a copy of the php code that i am using to witch is causeing the problem

Expand|Select|Wrap|Line Numbers
  1. class CYsHttpClass
  2. {
  3.     protected $cookies, $postdata,$r_header,$r_content,$s_request;
  4.     final protected function addCookie($k, $v)
  5.     {
  6.         if(is_array($k))
  7.             for($i=0;$i<sizeof($k);$i++)
  8.                 $this->cookies[$k[$i]] = $v[$i];
  9.         else
  10.             $this->cookies[$k] = $v;
  11.     }
  12.     final protected function addPostData($k, $v)
  13.     {
  14.         if(is_array($k))
  15.             for($i=0;$i<sizeof($k);$i++)
  16.                 $this->postdata[$k[$i]] = $v[$i];
  17.         else
  18.             $this->postdata[$k] = $v;
  19.     }
  20.     final protected function httpConnect($url,$method='GET',$referer='',$useragent='PayChain')
  21.     {
  22.         $port = 80; //Set Default Port to 80
  23.         $method = strtoupper($method);
  25.         list($protocol,$server,$script) = preg_split("/(http|https)?:\/\/([^\/]+)([^ ]*)/",$url,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
  27.         if($protocol=="https")
  28.             $port = 443;
  30.         if(strpos($server,":") != false)
  31.             list($server,$port) = preg_split("/([^:]+):(.+)/",$server,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
  33.         $cookiestring = "";
  34.         if(is_array($this->cookies))
  35.             if(sizeof($this->cookies) > 0)
  36.                 foreach($this->cookies as $key=>$value)
  37.                 {
  38.                     if(strlen($cookiestring) != 0)
  39.                         $cookiestring .= '; ';
  40.                     $cookiestring .= urlencode($key) . '=' . urlencode($value);
  41.                 }
  43.         $postdatastring = "";
  44.         if(is_array($this->postdata))
  45.         {
  46.             $postdatastring = "";
  47.             if(sizeof($this->postdata) > 0)
  48.                 foreach($this->postdata as $key=>$value)
  49.                 {
  50.                     if(strlen($postdatastring) != 0) $postdatastring .= '&';
  51.                     $postdatastring .= urlencode($key) . '=' . urlencode($value);
  52.                 }
  53.         }
  55.         $this->postdata = array(); // reset postdata field after use
  57.         $this->s_request="$method $script HTTP/1.1\r\n";
  58.         $this->s_request.="Host: $server\r\n";
  59.         $this->s_request.="Accept: */*\r\n";
  60.         if($cookiestring)
  61.             $this->s_request.="Cookie: $cookiestring\r\n";
  62.         if($referer)
  63.             $this->s_request.="Referer: $referer\r\n";
  64.         if($useragent)
  65.             $this->s_request.="User-Agent: $useragent\r\n";
  67.         $this->s_request.="Connection: close\r\n";
  69.         if($method == "POST")
  70.         {
  71.             $this->s_request.="Content-Type: application/x-www-form-urlencoded\r\n";
  72.             $this->s_request.="Content-Length: ".strlen($postdatastring)."\r\n";
  73.             $this->s_request.="\r\n$postdatastring\r\n";
  74.         }
  75.         else
  76.             $this->s_request.="\r\n";
  78.         $sock = fsockopen(($protocol=="https"? "ssl://".$server : $server), $port, $errno, $errstr);
  79.         if($sock)
  80.             fwrite($sock, $this->s_request);
  81.         else
  82.         {
  83.             $this->r_header = "$errstr ($errno)";
  84.             return -1;
  85.         }
  87.         $this->r_header = "";
  88.         while($str = trim(fgets($sock, 4096)))
  89.             $this->r_header .= "$str\n";
  91.         if(preg_match_all("/Set-Cookie: (.*); path/", $this->r_header, $newcookie))
  92.             foreach($newcookie[1] as $c)
  93.             {
  94.                 list($k,$v) = explode("=", $c);
  95.                 $this->cookies[$k] = $v;
  96.             }    
  98.         $this->r_content = "";
  99.         while(1)
  100.         {
  101.             $buf = fread($sock,8192);
  102.             if(strlen($buf) == 0) break;
  103.             $this->r_content .= $buf;
  104.         }
  105. //        echo("DEBUG:".$this->r_content);
  106.     }
  107. }

please if any can give some advice please let me know
Nov 6 '08 #1
0 10011

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Andrew Montgomery | last post by:
If anybody has experienced the following SquirrelMail error: Warning: fsockopen(): unable to connect to xx.xx.xx.xx:143 in /home/virtual/siteX/fst/var/www/squirrelmail/functions/imap_general.php on line 172 or something similar, then listen up, here's the solution. PHP 4.3.x has known bugs with file handle and socket leak issues. This is true up to PHP 4.3.3. The only solution for now is to revert to PHP 4.2.x. I'm told that this...
by: photoelectric | last post by:
When trying to run the below script on an apache/1.3.26 with mysql and php I get the following error message: Warning: mysql_connect() : Access denied for user: 'nobody@software-ece.rutgers.edu' (Using password: YES) in /ece/under/group14/public_html/insert.php on line 7 Unable to Select database I have no idea what the cause is, any help would be appreciated. Thanks in advance.
by: Jesse | last post by:
I'm having issues attempting to create an ssl connection using fsockopen. my code contains the following line . fsockopen("ssl://siteaddr",993,$errno,$errmsg,20); error message reported: Error: unable to connect to ssl://server.name.tld:993 When i tail the logs on the remote machine i see no connection attempts from the web server. it appears to die before attempting to make a
by: srinu | last post by:
Hello, We had one webserver based on a linux machine. The website is fully function and designed by a different person. Now we moved the machine from one IP to another one. I changed the machine ip address and the website is working partially. That site is working in between pages verywell. But once I give some input and requrest for data it is failing with the following message:
by: murd | last post by:
Hi, I am trying to complete a post using fsockopen but I'm getting the following error: "Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? I am running php 5.1.4 with apache 2 on fedora core 4. When I configured php I did it like this: ../configure --with-apxs2=/usr/sbin/apxs --with-mysql
by: Henry16 | last post by:
Never seen such a situation ! Do you have once faced this problem ? We use a fsockopen to retrieve a content from a URL . The content is dispalid corretly on a page on one of our servers. But on an other server (more-or-less same config.) the content is not displaid !! with the error message :: Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed:
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
by: susikto | last post by:
hi, I am getting this error when I am trying to connect the PSQL database. PHP Warning: pg_connect() : Unable to connect to PostgreSQL server: FATAL: user &quot;apache&quot; does not exist Can anyone tell me what the problem is? Regards susikta
by: shlomisderot | last post by:
Hi all, I'm trying to connect to MSSQL by using PHP but I got the following error: Warning: mssql_connect() : Unable to connect to server: When I'm using ODBC to connect MSSQL with the same connecting details, I succceed, so it's not a problem of wrong connection details Please, I'm waiting to some advice... Thank you
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...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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...
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...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.