Note that there are some explanatory texts on larger screens.

plurals
  1. POfsockopen does not always perform the mysql queries when page is refreshed
    primarykey
    data
    text
    <p>Server A uses fsockopen, fwrite, and fgets to collect information from remote server B. Remote server B creates mysql queries and provides this info. When server A first loads, all the information (from remote server B) appears on server A - meaning that the connection works fine. However, sometimes when the page is refreshed (on server A) none of remote server B's info is shown. Why is this?</p> <p>the code on server A is quite simple:</p> <pre><code>function test_http_request($path, $host, $test_request, $port=80){ $test_request_proc= test_encode($test_request); //http request $http_request = "POST $path HTTP/1.0\r\n"; $http_request .= "Host: $host\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; $http_request .= "Content-Length: " . strlen($test_request_proc) . "\r\n"; $http_request .= "User-Agent: testConnection/PHP\r\n"; $http_request .= "\r\n"; $http_request .= $test_request_proc; /////output $test_resource = ''; //open socket if(false == ($test_connect =@fsockopen('[remote server Bs IP ]', $port, $errno, $errstr, 10))){die('could not open test connection');} //send http_request fwrite($test_connect, $http_request); //get response while(!feof($test_connect))$test_resource .= fgets($test_connect, 1160); //close socket fclose($test_connect); $test_resource = explode("\r\n\r\n", $test_resource, 2); return $test_resource; } </code></pre> <p>According to remote server B's error logs the mysql queries (that are performed to supply the info to server A) are not being performed (the resource is boolean). Sometimes they are performed and sometimes they are not being performed. The problem is not in the query language as it works perfectly when the query is requested and performed on remote server B. Only when server A requests the info through fsockopen() does the problem crop up. <strong>note:</strong> the problem lies solely in the mysql queries performed by remote server B, any text outputted before-hand appears every time. Thanks for your time</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload