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

curl-and-php

WMS access via https authentication

From: <naddy_at_starwon.com.au>
Date: Wed, 24 Feb 2010 15:20:48 +1100

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
Received on 2010-02-24