Hi,to all<div>I try to wirte a program using webkit/gtk but It do not work !Please help !</div><div>the program is like this:</div><div><div>#include &lt;gtk/gtk.h&gt;</div><div>#include &lt;webkit/webkit.h&gt;</div><div>#include &lt;libsoup/soup.h&gt;</div><div>#include &lt;string.h&gt;</div><div><br></div><div>const gchar *uri = "http://127.0.0.1/cgi-bin/cgi_get";</div><div>const char &nbsp;*postdata = "Hi,I'm PostData";</div><div><br></div><div>void</div><div>soup_message_request_print(SoupMessage *sm)</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>SoupBuffer *sbf = NULL;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>sbf = soup_message_body_flatten(sm-&gt;request_body);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>g_warning("request_body-&gt;length:\n%llu\nend_length",sm-&gt;request_body-&gt;length);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>g_warning("request_body-&gt;data:\n%s\nend_data",sm-&gt;request_body-&gt;data);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>g_warning("flatten:\n%s\nend_faltten",sbf-&gt;data);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>soup_buffer_free(sbf);</div><div>}</div><div><br></div><div>int main(int argc,char **argv)</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>GtkWidget *webkit;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>GtkWidget *window;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>GtkWidget *scroll;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>WebKitNetworkRequest *nr;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>SoupMessage *sm;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>g_thread_init(NULL);</div><div>&nbsp;&nbsp; &nbsp;gtk_init(&amp;argc,&amp;argv);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>webkit = webkit_web_view_new ();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>scroll = gtk_scrolled_window_new(NULL,NULL);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>window = gtk_window_new(GTK_WINDOW_TOPLEVEL);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>gtk_container_add(GTK_CONTAINER(scroll),webkit);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>gtk_container_add(GTK_CONTAINER(window),scroll);</div><div><br></div><div>&nbsp;&nbsp; &nbsp;sm = &nbsp;soup_form_request_new (SOUP_METHOD_POST, uri,</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "accountType", "HOSTED_OR_GOOGLE",</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "Email", "username",</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "Passwd", "password",</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "service", "blogger",</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "source", "GNOME-Drivel-VERSION",</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NULL);</div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>nr = WEBKIT_NETWORK_REQUEST(g_object_new(WEBKIT_TYPE_NETWORK_REQUEST, "message", sm, NULL));</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>soup_message_set_request (sm,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>"text/html;charset=utf8",</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>SOUP_MEMORY_COPY,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>postdata,</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(gsize)strlen(postdata));</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>webkit_web_view_load_request(WEBKIT_WEB_VIEW(webkit),nr);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>soup_message_request_print(sm);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>gtk_window_resize(GTK_WINDOW(window),400,450);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>gtk_widget_show_all(window);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>g_signal_connect(window,"destroy",G_CALLBACK(gtk_main_quit),NULL);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>gtk_main();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>return 0;</div><div>}</div></div><div>///program code end</div><div>the cgi_get is:</div><div><div>#!/bin/bash</div><div>str=$(set|sed 's/$/\&lt;br\&gt;/g')</div><div><br></div><div>if [ "$REQUEST_METHOD" == "POST" ];then</div><div>str1="&lt;b&gt;YOU Post me :&lt;br&gt;&lt;I&gt;</div><div>&lt;font color=#FF0000 size=10&gt;$(cat)&lt;/font&gt;</div><div>&lt;/I&gt;&lt;br&gt;Post end&lt;br&gt;&lt;/b&gt;"</div><div>fi</div><div><br></div><div>cat &lt;&lt;lllllll &gt;/tmp/jjj.h</div><div>Content-Type: text/html; charset=UTF8</div><div><br></div><div>&lt;html&gt;</div><div>&lt;head&gt;</div><div>&lt;meta http-equiv=Content-Type content="text/html;charset=utf8"&gt;</div><div>&lt;body&gt;</div><div>${str1}</div><div>${str}</div><div>&lt;/body&gt;</div><div>&lt;/html&gt;</div><div>lllllll</div><div>chmod a+r /tmp/jjj.h</div><div>cat /tmp/jjj.h</div></div><div>###end cgi_get</div><div><br></div><div><br><div>--<br>
<div>--------weiketing------------<br><br></div>
</div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"><hr/>
<a href="http://help.163.com/10/1108/18/6L03I4G500753VB8.html" target="_blank">网易163/126邮箱百分百兼容iphone ipad邮件收发</a>
</span></span>