Wordpress - How to include a plugin's php file to another plugin functions file
The first error message means that there is restrictions in place on where you can include files from, set by the server. You could try with
require_once ABSPATH . '/wp-content/plugins/pluginname/pluginfunctions.php';
but I'm not sure if it would work.
With the second include you're trying to include an URL which is disabled by the server for security reasons.
However, why do you need to include the function of plugin B? If plugin B is present that means it's probably activated, which in turn means you can use the function directly from plugin A without needing to include the file specifically.