如何在codeIgniter上使用REST-client解析POST asp

时间:2014-05-18 02:48:43

标签: php asp.net codeigniter rest curl

Im Lost Please,如何使用CodeIgniter解决以下问题 REST-cliente库(REST)。

我尝试发送POST,webApp或WebResourse基于(ASP.net),所以想法是这样的:

getUser()

function getUser($ID){

//set config of the URL 
$config = array('server' => 'http://www.example.com/app/webapp/);

//initialize
$this->rest->initialize($config);

//now here is my problem look at this Im lost, I try this but I dont understand:

$postData = '__VIEWSTATE=/DKEKCdmdaEKEKEcnaEKEqkencKJE&'.
            '__EVENTVALIDATE=/DWRRKCkadjeEWWrjrDSJEJeW&'.
            'buttonSearch=search&'.
            'textFieldUserID='.$ID.';

$this->rest->option(CURLOPT_POSTFIELDS, $postData);

$this->rest->post('query/user.apsx'); 

//When run this, I use debug but NO show ERROR, this only return content html of page     whitout query of user data.

$this->rest->debug();

注意:我在构造函数中命名用户库rest和curl。我使用它来请求GET并且完美地工作。但我想做POST

$this->load->library('curl');
$this->load->library('rest');

图书馆: https://github.com/philsturgeon/codeigniter-restclient

感谢。!!!

1 个答案:

答案 0 :(得分:0)

正如你在问题中所述:

  

//运行时,我使用debug但是没有显示ERROR,这只返回   内容html页面whitout查询用户数据。

     

$这 - >休息 - >调试();

因此,如果您收到的是HTML而不是所需的数据,则问题在于您要求的服务器。你不确定你没有做出正确的要求,但很奇怪,因为他们应该告诉你什么是错的。

其他的事情是,你能粘贴给定的答案吗?只是要知道错误是什么,如果有的话。