phpSPO
phpSPO copied to clipboard
Error: Protocol "" not supported or disabled in libcurl
Dear Vadim,
I want to upload files to SharePoint using your library, I ran "FilesExamples.php" under folder "phpSPO\vendor\vgrem\php-spo\examples\SharePoint" and it displayed an error message "Error: Protocol "" not supported or disabled in libcurl ".
I've already updated the authentication info in "Settings.php".
And below are the errors found on log file.
Undefined index: scheme in /home/xxx/domains/xxx.xxx.com/public_html/library/vendor/vgrem/php-spo/src/Runtime/Auth/SamlTokenProvider.php on line 115
Undefined index: host in /home/xxx/domains/xxx.xxx.com/public_html/library/vendor/vgrem/php-spo/src/Runtime/Auth/SamlTokenProvider.php on line 115
Undefined index: scheme in /home/xxx/domains/xxx.xxx.com/public_html/library/vendor/vgrem/php-spo/src/Runtime/Auth/SamlTokenProvider.php on line 117
Undefined index: host in /home/xxx/domains/xxx.xxx.com/public_html/library/vendor/vgrem/php-spo/src/Runtime/Auth/SamlTokenProvider.php on line 117
Would you please guide me how to fix it. Thanks
Joanne
Can confirm that the latest has broken SharePoint uploads. Downgrading to 2.3.1 fixes it.
The error is in vgrem/php-spo/src/Runtime/Auth/OAuthTokenProvider.php:57
Undefined property: stdClass::$access_token
public function getAuthorizationHeader() { return 'Bearer ' . $this->accessToken->access_token; }
Greetings Joanne!
Not 100% certain why the error occurs in your case, but i remember someone experienced exactly the same error before. Turned out the root cause was the presence of a space(!) before the https
in site url, like this:
$url = " https://contoso.sharepoint.com"
$authCtx = new AuthenticationContext($url);
$authCtx->acquireTokenForUser($username,$password);
$ctx = new ClientContext($url,$authCtx);
The same issue was pinpointed and reported here
With regards, Vadim