destoon下app登陆api(json)

By | 2015年12月29日

版权声明:本文为博主原创文章,未经博主允许不得转载。


<pre name="code" class="php">响应:
<?php
defined('IN_DESTOON') or exit('Access Denied');

require DT_ROOT.'/module/'.$module.'/member.class.php';
 $apimember=new member;
 $apiinfo=array('retcode'=>-1,'msg'=>'Error:other');
if(isset($jsondata)){
 $apiuserinfo=json_decode(stripslashes($jsondata),true);
 if(isset($apiuserinfo['apiusername'])&&isset($apiuserinfo['apipassword'])){
 $apiuser=$apimember->login($apiuserinfo['apiusername'],$apiuserinfo['apipassword']);
 if(isset($apiuser)&&$apiuser<>''){
 $apiuser['picavatar']=DT_PATH."api/avatar/show.php?username=".$apiuser['username']."&size=large";
 $apiinfo=array('retcode'=>0,'msg'=>'sucess,Welcome!','userid'=>$apiuser['userid'],'credit'=>$apiuser['credit'],'credit'=>$apiuser['credit'],'groupid'=>$apiuser['groupid'],'picavatar'=>$apiuser['picavatar']);
 }else{
 $apiinfo=array('retcode'=>-2,'msg'=>'Error:Invalid username or password.');
 }
 }else{
 $apiinfo=array('retcode'=>-3,'msg'=>'Error:Required  username or password.');
 }
 }
 else{
 $apiinfo=$apiinfo;
 }
 echo json_encode($apiinfo);

?

请求
<?php 
 
 $urlcon= ‘http://xxxxp’;     //请求的URL      

$postdata=array(‘apiusername’=>’zengzc’, ‘apipassword’=>’a11111’);  //封装数组
$jsondata = json_encode($postdata);   //封装为json类型
//CURL会话模式
$host = $urlcon;
$ch = curl_init();
$jsondata = ‘jsondata=’.$jsondata;
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL,$host);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsondata);
echo $output = curl_exec($ch); 
curl_close($ch);

12 thoughts on “destoon下app登陆api(json)

  1. SeetDuri

    Aw, this was a really nice post. In concept I wish to put in writing like this additionally – taking time and precise effort to make an excellent article… however what can I say… I procrastinate alot and in no way appear to get one thing done. http://eurospinz24.ru

    Reply
    1. Elida

      Lola Sample dit :Belle Année à toi aussi chouchou !! Le laser, je sais pas pourquoi je préfère éviter pour l&trouq;instans…mais si ça ne marche pas je changerai peut être d’avis Oui vite vas y avant que le gros soleil revienne ! Bisouss

      Reply
  2. SeetDuri

    There are some fascinating deadlines on this article however I don’t know if I see all of them center to heart. There is some validity however I will take maintain opinion till I look into it further. Good article , thanks and we would like more! Added to FeedBurner as effectively http://eurobetsonline24.ru

    Reply
    1. Kayo

      After research just a few of the weblog posts on your website now, and I truly like your means of blogging. I bormoakked it to my bookmark website record and might be checking back soon. Pls take a look at my web page as properly and let me know what you think.

      Reply
  3. SeetDuri

    Nice post. I be taught one thing more difficult on different blogs everyday. It’s going to all the time be stimulating to learn content material from different writers and follow somewhat one thing from their store. I’d choose to make use of some with the content on my blog whether you don’t mind. Natually I’ll provide you with a link in your internet blog. Thanks for sharing. http://islotsonline24.ru

    Reply
  4. SeetDuri

    An impressive share, I simply given this onto a colleague who was doing a little evaluation on this. And he actually bought me breakfast as a result of I discovered it for him.. smile. So let me reword that: Thnx for the treat! However yeah Thnkx for spending the time to discuss this, I really feel strongly about it and love reading more on this topic. If potential, as you turn into expertise, would you mind updating your weblog with extra details? It’s highly useful for me. Large thumb up for this weblog submit! http://fireslots24.ru

    Reply
    1. Chuckles

      Oh ni har ju New york tavlan jag letat så länge efter !! Vad kostar den ?? Kan man få den skickad till Norrnöpikg ?? Snälla väntar ivrigt på svar. Mia

      Reply
  5. SeetDuri

    Nice post. I be taught one thing more difficult on completely different blogs everyday. It would at all times be stimulating to learn content material from different writers and apply a little something from their store. I’d desire to use some with the content material on my weblog whether you don’t mind. Natually I’ll offer you a link in your web blog. Thanks for sharing. http://diggyslots24.ru

    Reply
    1. Fanny

      I remember watching this on television and wishing that I was there even thought it wasn’t for me spclefiiacly to see all those beautiful black men in one place, pledging to do better and be better it would have been a powerful moving experience.

      Reply
  6. SeetDuri

    Aw, this was a really nice post. In concept I would like to put in writing like this moreover – taking time and precise effort to make a very good article… but what can I say… I procrastinate alot and by no means appear to get one thing done. http://skyslotsnow.ru

    Reply
    1. Prudy

      I still mostly learn about books through word of mouth. Two new ways I am learning about books is through emails from organizations to which I subscribe (WiesrrtDigest) and through online message boards.

      Reply
  7. Cherry

    Excelente dica Edu, só tenho uma sugestão para o texto que vc coloca “a criança aqui tb…” é que na lista de desaparecidos tem pessoas adultas, talvez fosse legal tirar o &#2ac0;2ri2nças≵e usar um termo mais generico. Detalhe, eu sei. ;)Parabéns pelo blog.

    Reply

发表评论

电子邮件地址不会被公开。 必填项已用*标注