{"id":423,"title":"php curl post","good":0,"bad":0,"hit":1734,"created_at":"2019-03-14 18:08:30","content":"
\n        $data = [\n            'type' => $type,\n            'tel' => $tel,\n            'system_id' => $this->config['system_id']\n        ];\n        $curl = curl_init();\n        \/\/\u8bbe\u7f6e\u6293\u53d6\u7684url\n        curl_setopt($curl, CURLOPT_URL, $this->sendApiUrl);\n        \/\/\u8bbe\u7f6e\u5934\u6587\u4ef6\u7684\u4fe1\u606f\u4f5c\u4e3a\u6570\u636e\u6d41\u8f93\u51fa\n        curl_setopt($curl, CURLOPT_HEADER, 0);\n        \/\/\u8bbe\u7f6e\u83b7\u53d6\u7684\u4fe1\u606f\u4ee5\u6587\u4ef6\u6d41\u7684\u5f62\u5f0f\u8fd4\u56de\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u8f93\u51fa\u3002\n        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);\n        \/\/\u8bbe\u7f6epost\u65b9\u5f0f\u63d0\u4ea4\n        curl_setopt($curl, CURLOPT_POST, 1);\n        \/\/\u8bbe\u7f6epost\u6570\u636e\n        $post_data = $data;\n        curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);\n        \/\/\u6267\u884c\u547d\u4ee4\n        $res = curl_exec($curl);\n        \/\/\u5173\u95edURL\u8bf7\u6c42\n        curl_close($curl);\n        \/\/\u663e\u793a\u83b7\u5f97\u7684\u6570\u636e\n        $arr = json_decode($res, true);<\/pre>

<\/p>"}