cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

PHP - CURL - Microsoft Sharepoint Server 2010 - Authorization

From: Petar Koretiæ <petar.koretic_at_gmail.com>
Date: Thu, 8 Dec 2011 14:57:54 +0100

About my server support that i think is relevant
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHP Version 5.3.3-7+squeeze3
CURL : 7.21.0
Features
NTLM Yes
Protocols dict, file, ftp, ftps, http, https, imap, imaps, ldap, ldaps,
pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

i'm trying to connect to a SharePoint site which
requires authorization that, truthfully, i don't know nothing about
anymore, it seems like it's modified (same user and pass for all of us, not
local, 'remember me' doesn't work)
anyway, i used libcurl many times and had no problem on various sites, and
google and documentation say i should have much of a problem now neither

the problem i'm facing is that curl doesn't post, i don't even get an
error, php just echoes page back even if i use same code i used on other
sites for authentication

(i can provide code i'm using but i don't think that would do much)

so how do i make successful authorization (or even failed post) based on
this real request (this is real data made by browser, user and password
aren't of course)
this is successful post with source option rather than parsed
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

   1. Request URL:
   https://wssim.t.ht.hr/_layouts/login.aspx?ReturnUrl=%2f
   2. Request Method:
   POST
   3. Status Code:
   302 Found
   4. Request Headersview parsed
      1. POST /_layouts/login.aspx?ReturnUrl=%2f HTTP/1.1 Host:
      wssim.t.ht.hr Connection: keep-alive Content-Length: 818
      Cache-Control: max-age=0 Origin: https://wssim.t.ht.hr User-Agent:
      Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko)
      Chrome/15.0.874.121 Safari/535.2 Content-Type:
      application/x-www-form-urlencoded Accept:
      text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: https://wssim.t.ht.hr/_layouts/login.aspx?ReturnUrl=%2f
      Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
   5. Query String Parametersview URL encoded
      1. ReturnUrl:
      /
      6. Form Dataview URL encoded
      1. __LASTFOCUS:
      2. __VIEWSTATE:

      /wEPDwUKMTc0NDQ2ODg4OQ9kFgJmD2QWAmYPZBYCAgMPZBYCAjUPZBYCAgEPPCsACgEADxYCHghVc2VyTmFtZQUEdGVzdGQWAmYPZBYGAgEPDxYCHgRUZXh0BYABUG9zbHXFvml0ZWxqIHZhcyBuaWplIG1vZ2FvIHByaWphdml0aS4gUHJvdmplcml0ZSBqZXN0ZSBsaSB1bmlqZWxpIGlzcHJhdm5vIGtvcmlzbmnEjWtvIGltZSBpIGxvemlua3UgaSB6YXRpbSBwb2t1xaFhanRlIHBvbm92by5kZAIFDw8WAh8BBQR0ZXN0ZGQCDQ8QDxYCHgdDaGVja2VkaGRkZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFJmN0bDAwJFBsYWNlSG9sZGVyTWFpbiRsb2dpbiRSZW1lbWJlck1lbfiRaFA/QrH2xtLcNAnzU9alXhs=
      3. __EVENTTARGET:
      4. __EVENTARGUMENT:
      5. __EVENTVALIDATION:
      /wEWBQKOlpeQBwLE96mtBQLLtsPBAgLkkP7MCgK/lZyyB7lmGymvBTkJ
      5Kj2eetXLC6PRyy
      6. ctl00$PlaceHolderMain$login$UserName: user
      7. ctl00$PlaceHolderMain$login$password: password
      8. ctl00$PlaceHolderMain$login$login:
      Prijava
      9. __spDummyText1:
      10. __spDummyText2:
      7. Response Headersview parsed
      1. HTTP/1.1 302 Found Cache-Control: private Content-Length: 9422
      Content-Type: text/html; charset=utf-8 Location: / Server:
      Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 Set-Cookie:
      .ASPXAUTH=7B91D01172F6C5F5215071BFBA499E9D97E7E2C75A88CDBC41B3EE99DFABFC623338D0FB7794B39D33251703FAFECEFEDAC1A74AE2E0EF1DD93E3861CA768E6D919CF7098248DA74A65FF4B5F38554CF45C48460FCCBEA836EC34D195709D55EC536BF1E322DF336B421CFD2087247D6CC14E93D;
      path=/; HttpOnly X-Powered-By:
ASP.NETMicrosoftSharePointTeamServices: 12.0.0.6421 Date: Thu, 08 Dec
2011
      13:24:14 GMT

----------------------------------------------------------------------------------------------------------------------------------
*and this is the unsuccessful request (no user&pass in input fields)
parsed options*
---------------------------------------------------------------------------------------------------------------------------------

   1. Request URL:
   https://wssim.t.ht.hr/_layouts/login.aspx?ReturnUrl=%2f
   2. Request Method:
   POST
   3. Status Code:
   200 OK
   4. Request Headersview source
      1. Accept:
      text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      2. Accept-Charset:
      ISO-8859-1,utf-8;q=0.7,*;q=0.3
      3. Accept-Encoding:
      gzip,deflate,sdch
      4. Accept-Language:
      en-US,en;q=0.8
      5. Cache-Control:
      max-age=0
      6. Connection:
      keep-alive
      7. Content-Length:
      558
      8. Content-Type:
      application/x-www-form-urlencoded
      9. Host:
      wssim.t.ht.hr
      10. Origin:
      https://wssim.t.ht.hr
      11. Referer:
      https://wssim.t.ht.hr/_layouts/login.aspx?ReturnUrl=%2f
      12. User-Agent:
      Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko)
      Chrome/15.0.874.121 Safari/535.2
      5. Query String Parametersview URL encoded
      1. ReturnUrl:
      /
      6. Form Dataview URL encoded
      1. __LASTFOCUS:
      2. __VIEWSTATE:

      /wEPDwUKMTc0NDQ2ODg4OQ9kFgJmD2QWAmYPZBYCAgMPZBYCAjUPZBYCAgEPZBYCZg9kFgICDQ8QDxYCHgdDaGVja2VkaGRkZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFJmN0bDAwJFBsYWNlSG9sZGVyTWFpbiRsb2dpbiRSZW1lbWJlck1lyBvugVHSL6dRxUgDGmWJOn4ReLo=
      3. __EVENTTARGET:
      4. __EVENTARGUMENT:
      5. __EVENTVALIDATION:
      /wEWBQK/vPf6CwLE96mtBQLLtsPBAgLkkP7MCgK/lZyyBzrGvaVwXdg1oTe7Cm
      Th3D/RMdY
      6. ctl00$PlaceHolderMain$login$UserName:
      7. ctl00$PlaceHolderMain$login$password:
      8. ctl00$PlaceHolderMain$login$login:
      Prijava
      9. __spDummyText1:
      10. __spDummyText2:
      7. Response Headersview source
      1. Cache-Control:
      private
      2. Content-Encoding:
      gzip
      3. Content-Length:
      3912
      4. Content-Type:
      text/html; charset=utf-8
      5. Date:
      Thu, 08 Dec 2011 13:36:00 GMT
      6. MicrosoftSharePointTeamServices:
      12.0.0.6421
      7. Server:
      Microsoft-IIS/7.0
      8. Vary:
      Accept-Encoding
      9. X-AspNet-Version:
      2.0.50727
      10. X-Powered-By:
      ASP.NET

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2011-12-08