I want to change the default style of the layer in Geo server using the REST API.
For this i have this code:
curl -v -u admin:geoserver -XPUT -H "Content-type: text/xml"
-d polygon "
http://mindcrewgis.com/geoserver/rest/layers/pymble:pymble_water
when run this command it is working fine form me. But when i convert this command in PHP then it is not working for me My PHP code for above curl command is
$url="http://mindcrewgis.com/geoserver/rest/layers/pymble:pymble_water";
$contentType = 'text/xml';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword");
$data="
polygon
";
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array("Content-Type: $contentType",
'Content-Length: '.strlen($data))
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$rslt = curl_exec($ch);
$info = curl_getinfo($ch);
?>
But this code is not working for me . There is something wrong in execute curl using PHP.
No comments:
Post a Comment