FYI, some hosts (incluing 1&1 and Dreamhost) disable the ability to use file_get_contents on a URL, which effectively stops Facebook Status from working. After some playing around, I was able to get it working using cUrl.

Essentially, I turned this:

	  if (!$rss = file_get_contents($statusurl)) {
		watchdog('fbstatus', 'Could not fetch via file_get_contents '. $statusurl);
		return '';
	  }
<code>

Into this:
<code>
    if (function_exists('curl_init')) {
      $ch = curl_init($statusurl);
      curl_setopt($ch, CURLOPT_VERBOSE, 1);
	  curl_setopt($ch, CURLOPT_URL, $statusurl); 
	  curl_setopt($ch, CURLOPT_TIMEOUT, 60);
	  curl_setopt($ch, CURLE_OPERATION_TIMEOUTED, 30);
	  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
	  curl_setopt($ch, CURLOPT_USERAGENT, 'Firefox');
	  if (!$rss = curl_exec($ch)) {
		$curlInfo = curl_getinfo ($ch);
		$curlError = curl_error($ch);
		watchdog('fbstatus', 'Could not fetch via curl '. $statusurl .': '. $curlInfo .', '. $curlError);
		return '';
	  }
    }
    else {
	  if (!$rss = file_get_contents($statusurl)) {
		watchdog('fbstatus', 'Could not fetch via file_get_contents '. $statusurl);
		return '';
	  }
    }

It took some playing around with it, so it probably uses more options than absolutely necessary.

On a separate note, it's worth noting that SimpleXML isn't available in all environments (particularly for PHP 4), so you should probably list that in the requirements.

Comments

yelvington’s picture

Category: bug » feature

Changing to a feature request. I'll consider making CURL an option but not a requirement, as many hosts don't support it. I had intended to use drupal_http_request, which solves the problem for everyone, but discovered that Facebook appeared to be checking the user agent string and had to add the "Firefox" fakery.

Regarding the PHP4 issue, that is documented on the project page ("PHP5 is an absolute requirement"). In addition, if the PHP5 requirement is not met, both the Drupal 5 and Drupal 6 versions of the module will refuse to be installed.

yelvington’s picture

I have converted to drupal_http_request successfully, much to my surprise. Facebook did not have an issue with the user agent. When I get a chance to alligator-wrestle CVS again, I'll release the changed version, which should remove any issues with dumb webhosts blocking file_get_contents().

yelvington’s picture

Status: Active » Closed (fixed)

Current versions use the Drupal API, so I'm closing this issue.