Hello,

 

I'm having a problem with upload a SLD file to geoserver using REST.

 

This is the code I;m having so far:

 

// URL on which we have to post data

        $url = "http://localhost/geoserver/rest/styles/line";;

        // Any other field you might want to catch

        $post_data['name'] = "line";

        // File you want to upload/post

        $post_data['file'] = "@d:/sld/lucas.sld";

 

        // Initialize cURL

        $ch = curl_init();

        // Set URL on which you want to post the Form and/or data

        curl_setopt($ch, CURLOPT_URL, $url);

        curl_setopt($ch, CURLOPT_USERPWD, "admin:geoserver");

        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type:
application/vnd.ogc.sld+xml"));

        // Data+Files to be posted

        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

        // Pass TRUE or 1 if you want to wait for and catch the response
against the request made

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        // For Debug mode; shows up any error encountered during the
operation

        curl_setopt($ch, CURLOPT_VERBOSE, 1);

        // Execute the request

        $response = curl_exec($ch);

        

        // Just for debug: to see response

        echo $response;

 

But I get nog error and the file is not uploaded...any idea?

 

 

Met vriendelijke groet,
Lucas Heezen

 

Covadis b.v. 

t: 026 3616600 

Geograaf 12 

f: 026 3612317 

6921 EW Duiven 

e: [email protected] <mailto:[email protected]> 

 

 

<<image001.gif>>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to