Re: WMS access via https authentication

Shanshui Liu <[email protected]>
Newsgroups gmane.comp.web.curl.php
Message-ID <[email protected]>
Hi Nicholas,

Shouldn't CURLOPT_URL be set to the URL of the WMS layer instead?

With regards,
Liu Shan Shui
http://lx.sg/
"Life would be much easier if I had the source code." - Anonymous


On Wed, Feb 24, 2010 at 12:20 PM, <[email protected]> wrote:

> Hi all,
>
> I am a novice user to CURL but not PHP. I was hoping someone could give me
> a heads up on a problem I am tackling for which I have had trouble finding
> suitable examples. As such it feels like I am banging away in the dark.
>
> I need to access this WMS layer:
>
>
> https://www2.landgate.wa.gov.au/ows/wmspublic?service=wms&version=1.1.1&request=GetMap&format=image/png&width=800&height=600&transparent=false&layers=LGATE-001&bbox=115.8479,-31.9083,115.8626,-31.8984&SRS=EPSG:4326 ?- (the wms page I need to access)
>
> served from a government website which requires a user name and password
> prior to accessing the WMS which uses https basic authentication.
>
> https://www2.landgate.wa.gov.au/slip/portal/home/home.html  ?-(the login
> page)
>
> the code I have so far is below  I get a http_code of 200 and an error code
> of 0 but i'm not really sure what this means or where to go from here. i.e.
> the flow of pages etc.
>
> <?php
> // create a new cURL resource
> $ch = curl_init();
> $demo='
> https://www2.landgate.wa.gov.au/siteminderagent/forms/slip_login_frame.fcc
> ';
>
> $username = 'username';
> $password = 'password';
>
> // set URL and other appropriate options
> curl_setopt($ch, CURLOPT_URL, "$demo");
> curl_setopt($ch, curlopt_content_type,"text/xml");
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
> curl_setopt($ch, CURLINFO_HEADER_OUT, true);
> curl_setopt($cURL,CURLOPT_USERPWD,"$username:$password");
>
> // grab URL and pass it to the browser
> $data=curl_exec($ch);
> $info=curl_getinfo($ch);
> //var_dump(curl_getinfo($ch,CURLINFO_HEADER_OUT));
> echo $info['http_code'];
> echo "\n\ncURL error number:" .curl_errno($ch);
>
> print_r("$data");
> ?>
>
> I would greatly appreciate any advice. As you can see I am not sure even
> where to start.
>
> nicholas
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.