來源嘗試此命令:http://exhibita.com/blog/post/2009/09/10/Using-Google-Spreadsheets-to-Collect-Form-Data.aspx
1: //In order to post to Google Spreadsheet Form
2: //http://spreadsheets.google.com/formResponse?formkey=dFdYSTlzUVJsSomeReallyLongKeyGoesHereqemU2YUE6MA..
3: //Name "entry.0.single"
4: //Email is "entry.1.single"
5: //Phone is "entry.2.single"
6: //Comment is "entry.3.single"
7: //IP address is "entry.4.single"
8: $url = 'http://spreadsheets.google.com/formResponse?formkey=dFdYSTlzUVJsSomeReallyLongKeyGoesHereqemU2YUE6MA..';
9: // Create post array to send results to Google Spreadsheets
10: $fields = array(
11: 'entry.0.single'=>urlencode($name),
12: 'entry.1.single'=>urlencode($email),
13: 'entry.2.single'=>urlencode($phone),
14: 'entry.3.single'=>urlencode($comments),
15: 'entry.4.single'=>getRealIpAddr(),
16: 'submit'=>'submit'
17: );
18:
19: // Begining of code for posting to Google Spreadsheet
20: $fields_string = '';
21: //url-ify the data for the POST
22: foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
23: //rtrim($fields_string,"& ");
24: $fields_string = substr($fields_string, 0, strlen($fields_string)-1);
25: $result = "Fields_String: [" . $fields_string . "]<br />";
26:
27: //set POST variables for Google Spreadsheets
28: //open connection
29: $ch = curl_init();
30:
31: //set the url, number of POST vars, POST data
32: curl_setopt($ch,CURLOPT_URL,$url);
33: curl_setopt($ch,CURLOPT_POST,count($fields));
34: curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
35: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
36: curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
37:
38: //execute post
39: $result .= "Curl Results: [" . curl_exec($ch) . "]<br />";
40:
41: //close connection
42: curl_close($ch);
當然這是使用PHP和捲曲,我認爲它不應該太難從終端做。 只需要我的$ 0.02。
0123雖然我發現這個鏈接,但無法將其轉換... – coure2011 2011-12-30 19:38:09
你卡在哪裏 – 2011-12-30 19:48:18