2009-11-28 137 views
1

我在嘗試將數據從我的應用程序同步到服務器上。我非常喜歡 這種工作。 爲此,我寫在PHP一個小型Web服務,與服務器同步數據

現在,我無法弄清楚如何調用這個Web服務,以及如何 從應用程序中的2個變量值發送到insertData功能使用xCode的 。

任何形式的幫助,將不勝感激。

感謝&問候, NR

回答

1

我不會同步一般通過PHP或HTTP的數據,如果我沒有到。我會使用簡單的東西,例如scprsync或者,如果數據與我的應用程序有關的某些版本控制,如git

但是,通過PHP這樣做可能會是這個樣子:

<!-- server side, lets say the url is http://example.org/sync.php --> 
<?php 
    insert_stuff($_GET["username"], $_GET["password"]); 
    echo "Inserted.\n"; 
?> 

在本地,我會使用curl

$ curl "http://example.org/sync.php?username=root&password=root" 
Inserted. 

...