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

curl-and-php

Re: PHP - CURL - Microsoft Sharepoint Server 2010 - Authorization

From: Petar Koretiæ <petar.koretic_at_gmail.com>
Date: Thu, 8 Dec 2011 17:49:07 +0100

this is the code that works when I use it with other server accessible only
from our network (intranet)
------------------------------------------------------------------------------------------------------------------------------------------------------------
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName");
curl_setopt($ch, CURLOPT_URL,"
https://siteadress.hr/login/j_spring_security_check");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"j_username=local_username&j_password=local_password");
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_MAXREDIRS,10);
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.23 (Windows NT 5.1; U; en)');

curl_exec ($ch);
------------------------------------------------------------------------------------------------------------------------------------------------------------
but when i change address and set it to what was in the first message
(adress that is accessible from everywhere, everybody can try to login with
false data) and test it, the page is then just displayed, nothing happens,
no posting as i can see and no errors

so i've tried more and more
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
$LOGINURL = "https://wssim.t.ht.hr/_layouts/login.aspx?ReturnUrl=%2f";
$POSTFIELDS = 'ctl00$PlaceHolderMain$login$login=Prijava'; //i've tried
with all post fields that are needed but it's the same as with one
$reffer = "https://wssim.t.ht.hr/_layouts/login.aspx?ReturnUrl=%2f";

$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.23 (Windows NT 5.1; U; en)');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_MAXREDIRS,10);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch,CURLOPT_USERPWD,"user:pass");
    $result = curl_exec ($ch);
------------------------------------------------------------------------------------------------------------------------------------------------------------

but no luck...of course, i've tried many things, but i fear i'm probably
heading in the wrong direction with more options...

------------------------------------------------------------------------------------------------------------------------------------------------------------

On Thu, Dec 8, 2011 at 5:31 PM, David Colter <dolan2go_at_yahoo.com> wrote:

> Hi
>
> 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
>
>
> We will need your code to understand your question & request.
>
> David
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>

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