fsocket_connect Help

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm trying to read the page
https://mpl-rdp-irm.mtn-park-lodges.com/irm/default.asp?IRMPath =\mplLobstick\rdpnt\rdp\&IRMResort=02
but having little luck. as it seems like the connect returns Success
(0) instead of letting me read the page...

Any ideas?

$host = "mpl-rdp-irm.mtn-park-lodges.com";
$port = 443;
$path = "/irm/default.asp";

//you will need to setup an array of fields to post with
//then create the post string
$formdata["IRMPath"] = "\mplLobstick\rdpnt\rdp\"";
$formdata["IRMResort"] = "02";
//build the post string
  foreach($formdata AS $key => $val){
   $poststring .= urlencode($key) . "=" . urlencode($val) . "&";
// strip off trailing ampersand
$poststring = substr($poststring, 0, -1);

$fp = fsockopen("ssl://".$host, $port, $errno, $errstr, $timeout = 30);

 //error tell us
 echo "$errstr ($errno)\n";
 echo "\nThis is printing success  $fp  ";


  //send the server request
  fputs($fp, "POST $path HTTP/1.1\r\n");
  fputs($fp, "Host: $host\r\n");
  fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
  fputs($fp, "Content-length: ".strlen($poststring)."\r\n");
  fputs($fp, "Connection: close\r\n\r\n");
  fputs($fp, $poststring . "\r\n\r\n");

  //loop through the response from the server
  while(!feof($fp)) {
   echo "<BR>line: " . fgets($fp, 4096);
  //close fp - we are done with it


Re: fsocket_connect Help


on 08/29/2005 07:07 PM blaine@worldweb.com said the following:
Quoted text here. Click to load it

AFAIK, success is not 0 . Probably you do not have SSL support enabled.

Anyway, you may also want to try this HTTP client class that supports  
SSL either with fsockopen or curl, depending on which is available. If  
it fails, it returns an explanatory error message.



Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP

PHP Reviews - Reviews of PHP books and other products

Metastorage - Data object relational mapping layer generator

Site Timeline