使用curl和php发布数据时出现问题

时间:2013-03-07 19:36:27

标签: php url post curl http-post

我正在尝试将名称和类型字段发布到代码中的某些页面....发布日期时显示我的其他消息“未创建”。如何使用php和curl发布数据

enter code here

<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"http://demo.tools.krds.com/dispatch_ws.php?     
action=create");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
        "name=mani&type=developer");

// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

 $server_output = curl_exec ($ch);
 curl_close ($ch);
 print_r($server_output);

  if ($server_output == "OK") {
  echo "created";
  } else {
  echo "not created";
   }
   ?>

0 个答案:

没有答案