Jump to content

jerez_z

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jerez_z's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am attempting to pass some post data to a external site providing some verification services for me. I'm using this function to pass the data: function do_post_request($url, $data, $optional_headers = null) { $params = array('http' => array( 'method' => 'post', 'content' => $data )); if ($optional_headers!== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); if (!$fp) { throw new Exception("Problem with $url, $php_errormsg"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from $url, $php_errormsg"); } return $response; } The data I'm passing is just a string of xml. Everytime I try it with a regular (http) url it works fine, returns me the contents of the page (which is also xml data). However whenever I try to use a secure (https) url it throws this error: sample source: <html> <head> <title>Submission Test</title> </head> <body> <?php function do_post_request($url, $data, $optional_headers = null) { $params = array('http' => array( 'method' => 'post', 'content' => $data )); if ($optional_headers!== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); if (!$fp) { throw new Exception("Problem with $url, $php_errormsg"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from $url, $php_errormsg"); } return $response; } echo "Let's do a little test.<br><br>"; echo "Data to be submitted:<br><br>"; $xmlsend = new SimpleXMLElement('<dataxinquiry></dataxinquiry>'); /* build my xml submission here */ echo "<xmp>"; echo $xmlsend->asXML(); echo "</xmp><br><br>"; echo "Submitting data.....<br><br>"; $result = do_post_request('https://www.mysecureaddress.com', $xmlsend->asXML()); echo "Returned information:<br><br>"; echo "<xmp>"; echo $result; echo "</xmp>"; ?> </body> </html> anyone know what might be causeing this problem and what I could do about it?
  2. I have a socket server I wrote in PHP. It works like a charm and everything is good except when the server gets somewhat of a load (like several xml messages a second) it closes all connections. You can reconnect afterwards and it works again but still can't handle the load, but I need it to be able to handle this much information. Any ideas what this problem could be and how I could go about fixing it?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.