See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Apply edits with PHP

General Tech Bugs & Fixes
Max. 2000 characters

Alex Wilson


( 6 months ago )


I trying to develop a PHP script that will simply applyedits to a feature services.

Right now I'm trying to use the In the ESRI restend point example. I'm thinking if someone can help me, point me to some doc, show me how to use the esri endpoint. I will be able to take that script learn from it and move from there. There are several moving parts I'm hoping to accomplish but right now I'm stuck on this piece.

If I hit this esri rest endpoint:

and add these parameters to the add input box

[{"geometry":{"x":-13085962.2699721,"y":4061306.82523268,"spatialReference":{"wkid":102100}},"attributes":{"description":"Test Nat","type":5}},{"geometry":{"x":-13072136.6421672,"y":4073467.58686212,"spatialReference":{"wkid":102100}},"attributes":{"description":"klsf","type":0}}]

I can add a feature.

I want to create a simple PHP script that will do this for me. CAN someone show how to do this?

If I can get this working I'm hoping I can feed the parameters from an xml feed and consistently push data to my rest points. Thanks.

Rukhsar Fatima


( 6 months ago )


this should do it. Remind that this is not asynchronous.

$adds ='[{"geometry":{"x":-13085962.2699721,"y":4061306.82523268,"spatialReference":{"wkid":102100}},"attributes":{"description":"Test Nat","type":5}},{"geometry":{"x":-13072136.6421672,"y":4073467.58686212,"spatialReference":{"wkid":102100}},"attributes":{"description":"klsf","type":0}}]';

$postdata = http_build_query(
    'adds' => $adds,
    'updates'=> 'null',
    'f' => 'json'       
$opts = array('http' =>
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => $postdata
$context  = stream_context_create($opts);   
$result = file_get_contents(*YOUR_FS_URL*, false, $context);    
$result2 = json_decode($result,true);/*decode the result as array*/
$result3 = json_decode($result);/*decode the result as object*/


what's your interest