Home > Backend Development > PHP Tutorial > 求大神翻译成C#

求大神翻译成C#

WBOY
Release: 2016-06-23 14:11:40
Original
821 people have browsed it

    $key = mysql_escape_string($_GET["msg"]);
    $post_data = array (
        'requestContent=' . $key
    );
    $post_data = implode ( '&', $post_data );
    $url = 'http://nlp.xiaoi.com/robot/demo/wap/wap-demo.action';
                       
    $ch = curl_init ();
    curl_setopt ( $ch, CURLOPT_POST, 1 );
    curl_setopt ( $ch, CURLOPT_URL, $url );
    curl_setopt ( $ch, CURLOPT_POSTFIELDS, $post_data );
    ob_start ();
    curl_exec ( $ch );
    $result = ob_get_contents ();
    ob_end_clean ();
                       
    $preg = '/(.*)/iUs';
    preg_match_all ( $preg, $result, $match );
    $response_msg = $match [0] [0];
    $preg = "/]+>/i";
    $response_msg = preg_replace ( $preg, '', $response_msg );
    if ("hello,how are you" == $response_msg || "how do you do" == $response_msg) {
        $response_msg = "小i机器人欢迎您,作者主页地址:50vip.com。小i机器人不断学习中,欢迎各种调戏.../:,@-D"; // 欢迎语
    }
    $response_msg = trim ( $response_msg );
    echo $response_msg;
?>


回复讨论(解决方案)

c#+curl

c#+curl

httprequest   httpresponse   不就可以吗   我看不懂php   不知道他在干嘛

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template