• On my server I had PHP’s Safe mode on. So I could not use “file_get_contents”. Added this if-else to your code:

    $url = 'http://api.whatpulse.org/user.php?UserID='.$options['UserID'].'&format=json';
    
    	// Get JSON
    	if(function_exists('curl_init')) {
    		$ch = curl_init();
    
    		curl_setopt($ch, CURLOPT_URL, $url);
    		curl_setopt($ch, CURLOPT_HEADER, false);
    		curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: WORDPRESSWIDGET/1.0');
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    		$link  = curl_exec($ch);
    		$http_code = (string)curl_getinfo($ch, CURLINFO_HTTP_CODE);
    
    		if($http_code{0} != 2)
    			return false;
    
    		curl_close($ch);
    	} else {
    		$link = file_get_contents($url);
    	}

    Maybe you can update it for other users that have the same problem.

    http://wordpress.org/plugins/whatpulse-widget-for-wordpress/

The topic ‘php safemode on’ is closed to new replies.