donglian2106 2015-08-12 08:24
浏览 75

卷曲 - SPNEGO无法找到谈判机制

i'm trying to use php-curl with a microsoft web service: Here is my code (working on windows 10 with wamp):

<?php

$location = "http://10.0.100.19:7058/FOLDER12013/OData/Company('TEST')/WS_Clienti";
$handle = curl_init($location);

$credentials = 'CPGNET\username:password';
$action =


$proxy =  '11.22.33.44:8123';
$headers = [
    'Method: GET',
    'User-Agent: PHP-SOAP-CURL',
    'Content-Type: text/xml; charset=utf-8',
];


// Authentication
curl_setopt($handle, CURLOPT_HTTPAUTH, CURLAUTH_NTLM | CURLAUTH_BASIC | CURLAUTH_GSSNEGOTIATE | CURLAUTH_ANY);
curl_setopt($handle, CURLOPT_USERPWD, $credentials);

curl_setopt($handle, CURLINFO_HEADER_OUT, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
curl_setopt($handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($handle, CURLOPT_PROXY,$proxy);

$response = "";
echo("<pre>");
$response = curl_exec($handle);

$url_info = curl_getinfo($handle);

print_r($url_info);

echo(htmlentities($response));
echo("</pre>");

When I try to use this code from centos 7 (or ubuntu 15) I have an error 401 unautorized. Php, curl, libcurl have the same version on windows and linux (and all extensions are equal checking with phpinfo). So, I'm trying to use curl from linux:

curl --negotiate -u "CPGNET\username:password" --proxy 11.22.33.44:8123 "http://10.0.100.19:7058/FOLDER12013/OData/Company('TEST')/WS_Clienti" -v

But I have an error:

* gss_init_sec_context() failed: : SPNEGO cannot find mechanisms to negotiate

Please someone can help me. I don't understand why from linux this not works. Thank you

  • 写回答

1条回答 默认 最新

  • dongqian7545 2018-12-18 19:30
    关注

    a bit old question, but ...

    It could be you are hitting a problem with a ntlm authentication via gssapi of curl. Please take a look to following links:

    评论

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应