IOS ASIHttpRequest get & PHP

OBJECT C :
-(void)getTest
{
    NSString *strURL = [[HttpCom SR_Root] stringByAppendingFormat:@"Test/get_test?par1=%d&par2=%@",10,@"123"];
    NSLog(@"URL:%@",strURL);
    NSURL *URL = [NSURL URLWithString:strURL];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:URL];
    [request startSynchronous];
    if (request.error == nil) {
        NSString *string = request.responseString;
        NSLog(@"getTest:%@",string);
    }else{
        NSLog(@"%@",request.error.description);
    }
    
}

PHP : php

function __construct()
		{
		parent::__construct();
		}
	
	
	public function Get_test()
	{
		echo "get_test";
		 $par1 = $_GET["par1"];
		 $par2 = $_GET["par2"];
		 echo "par1:".$par1;
		 echo "par2:".$par2;
	}



Result:

getTest:get_testpar1:10par2:123 code

相關文章
相關標籤/搜索