Joined: Apr 06, 2006 Posts: 2401 Location: Iowa, USA
Posted:
Thu Nov 29, 2007 3:18 pm
CURL is a library for doing http type stuff. That's a really lame answer. They should be able to tell you immediately if fsockopen() is ok to use. Hint: get a new host.
Joined: Aug 27, 2002 Posts: 15210 Location: Kansas
Posted:
Tue Jan 01, 2008 12:50 pm
Evaders99 wrote:
One caveat is that the web server must be running as root
This is dependent on how the socket_create function is being called. User scripts can also execute an equivalent operation. We (and/or Bob) need to look into this as I believe this was an issue before v2.5.15.
Joined: Dec 05, 2007 Posts: 72 Location: Tampa, Florida
Posted:
Mon Jan 07, 2008 2:29 am
Gremmie wrote:
CURL is a library for doing http type stuff. That's a really lame answer. They should be able to tell you immediately if fsockopen() is ok to use. Hint: get a new host.
To test Fopen and Curl
Code:
<?PHP
// This script tests two methods of connecting to the feed server to see which are enabled
$data = getDataViaFopen("http://www.msn.com");
if (!empty($data1)) print "Fopen Works<br>";
$data = '';
if (!$fp) {
echo "Fsockopen test failed.";
} else {
fwrite($fp, $out);
$body = false;
while (!feof($fp)) {
$file_contents .= fgets($fp, 8192);
}
fclose($fp);
return $file_contents;
}
}
function getDataViaCURL($url){
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
curl_setopt($ch, CURLOPT_FAILONERROR, 1); // Fail on errors
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_PORT, 80); //Set the port number
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum