• sgilleland1

    (@sgilleland1)


    We had API’s developed for a mobile app that we are creating, one is for login. Here is the post string….

    http://www.ivolleytech.com/api/login.php?username=parveen&password=123456

    When put into a browser everything is fine…we get

    {"status":"3","message":{"message":"Logged in Successfully","data":{"0":"6707","member_id":"6707","1":"parveen","user_name":"parveen","2":"parveen","first_name":"parveen","3":"kinger","last_name":"kinger","4":"$P$B8lnLoGAce9eJPyJX8RcIp4SAmG.PW.","password":"$P$B8lnLoGAce9eJPyJX8RcIp4SAmG.PW.","5":"0000-00-00","member_since":"0000-00-00","6":"5","membership_level":"5","7":"","more_membership_levels":"","8":"active","account_state":"active","9":"2014-04-24 06:02:43","last_accessed":"2014-04-24 06:02:43","10":"202.164.42.227","last_accessed_from_ip":"202.164.42.227","11":"parveen@cqlsys.com","email":"parveen@cqlsys.com","12":"","phone":"","13":"","address_street":"","14":"","address_city":"","15":"","address_state":"","16":"","address_zipcode":"","17":"","home_page":"","18":"","country":"","19":"not specified","gender":"not specified","20":"","referrer":"","21":"","extra_info":"","22":"","reg_code":"","23":"2014-04-23","subscription_starts":"2014-04-23","24":"0","initial_membership_level":"0","25":"","txn_id":"","26":"123","subscr_id":"123","27":"techodata","company_name":"techodata","28":"0","flags":"0","29":"","notes":"","30":"","profile_image":"","31":"0000-00-00","expiry_1st":"0000-00-00","32":"0000-00-00","expiry_2nd":"0000-00-00","33":"not specified","title":"not specified"}}}

    But when we try it in xcode and appery.io we get this:

    {
      <strong>  "status":"404 Not Found",</strong>
        "url":"http://www.ivolleytech.com/api/login.php",
        "response":{
            "status":"3",
            "message":{
                "message":"Logged in Successfully",
                "data":{
                    "0":"6707",
                    "1":"parveen",
                    "2":"parveen",
                    "3":"kinger",
                    "4":"$P$B8lnLoGAce9eJPyJX8RcIp4SAmG.PW.",
                    "5":"0000-00-00",
                    "6":"5",
                    "7":"",
                    "8":"active",
                    "9":"2014-04-24 06:02:43",
                    "10":"202.164.42.227",
                    "11":"parveen@cqlsys.com",
                    "12":"",
                    "13":"",
                    "14":"",
                    "15":"",
                    "16":"",
                    "17":"",
                    "18":"",
                    "19":"not specified",
                    "20":"",
                    "21":"",
                    "22":"",
                    "23":"2014-04-23",
                    "24":"0",
                    "25":"",
                    "26":"123",
                    "27":"techodata",
                    "28":"0",
                    "29":"",
                    "30":"",
                    "31":"0000-00-00",
                    "32":"0000-00-00",
                    "33":"not specified",
                    "member_id":"6707",
                    "user_name":"parveen",
                    "first_name":"parveen",
                    "last_name":"kinger",
                    "password":"$P$B8lnLoGAce9eJPyJX8RcIp4SAmG.PW.",
                    "member_since":"0000-00-00",
                    "membership_level":"5",
                    "more_membership_levels":"",
                    "account_state":"active",
                    "last_accessed":"2014-04-24 06:02:43",
                    "last_accessed_from_ip":"202.164.42.227",
                    "email":"parveen@cqlsys.com",
                    "phone":"",
                    "address_street":"",
                    "address_city":"",
                    "address_state":"",
                    "address_zipcode":"",
                    "home_page":"",
                    "country":"",
                    "gender":"not specified",
                    "referrer":"",
                    "extra_info":"",
                    "reg_code":"",
                    "subscription_starts":"2014-04-23",
                    "initial_membership_level":"0",
                    "txn_id":"",
                    "subscr_id":"123",
                    "company_name":"techodata",
                    "flags":"0",
                    "notes":"",
                    "profile_image":"",
                    "expiry_1st":"0000-00-00",
                    "expiry_2nd":"0000-00-00",
                    "title":"not specified"
                }
            }
        }
    }

    Please help!

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • catacaustic

    (@catacaustic)

    Is this associated with WordPress at all?

    Thread Starter sgilleland1

    (@sgilleland1)

    Yes, this is an API that was written for WordPress and this is the result when it is ran.

    catacaustic

    (@catacaustic)

    If you look at the result that you got back in XCode, you’ll see that all of the data is there, but it’s been nested lower in the structure. It'[s up to you on how you deal with that.

    The only other issue is the 404 status. Your API is returning this, so you’ll need to figure out why it’s doing this.

    Neither of these have anything to do with WordPress.

    Thread Starter sgilleland1

    (@sgilleland1)

    Sorry, it I wasn’t clear….the 404 is the problem I am trying to figure out.

    If it is any help, here is the api code

    <?php
    ob_start();
    require_once(“database.php”);
    require_once(“../wp-blog-header.php”);
    $dbconnnection = new DB();
    $dbconnnection->fun_db_connect();

    $start =$_REQUEST[‘start’];
    $category =$_REQUEST[‘category’];

    if(!isset($category) OR trim($category)==””) {
    $record = ‘Category name required’;
    $dbconnnection->sendResponse(‘3’,$record);
    exit;
    }
    $idObj = get_category_by_slug($category);

    if(trim($idObj->slug)==””) {
    $record = ‘Category not found’;
    $dbconnnection->sendResponse(‘3’,$record);
    exit;
    }

    if(trim($start)==””) {
    $start=0;
    }

    $query = “SELECT * FROM wp_posts p
    LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID
    LEFT OUTER JOIN wp_term_taxonomy x ON x.term_taxonomy_id = r.term_taxonomy_id
    LEFT OUTER JOIN wp_terms t ON t.term_id = x.term_id
    WHERE p.post_status = ‘publish’
    AND p.post_type = ‘post’
    AND t.slug = ‘”.$idObj->slug.”‘ limit $start,20″;
    $res = mysql_query($query);
    $rows=mysql_num_rows($res);

    if($rows >0) {
    $post=””;
    $data=””;
    while($data=mysql_fetch_assoc($res)){
    $meta_values_video = get_post_meta( $data[‘ID’], ‘_my_meta_value_key’, true );
    $meta_values_video_thumbnail = get_post_meta( $data[‘ID’], ‘_video_thumbnail’, true );
    $meta_post_thumbnail=wp_get_attachment_image_src( get_post_thumbnail_id( $data[‘ID’] ), ‘single-post-thumbnail’ );

    $data[‘video_url’]=$meta_values_video;
    $data[‘video_thumbnail’]=$meta_values_video_thumbnail;
    $data[‘post_thumbnail’]=$meta_post_thumbnail[0];
    //$data[‘post_thumbnail’]=$meta_post_thumbnail[0];
    $data[‘post_content’]=htmlentities($data[‘post_content’]);

    $post[]=$data;
    }

    $dbconnnection->sendResponse(‘3’,$post);
    exit;

    } else {

    $record = ‘Post not found’;
    $dbconnnection->sendResponse(‘3’,$record);

    exit;

    }
    ?>

    catacaustic

    (@catacaustic)

    There’s no possible way to tell from that code. That part of whatever you’ve got doesn’t output any header information, so the 404 isn’t controlled by this part of the code.

    The only thing in your code that points to anything like that is this line:

    $dbconnnection->sendResponse('3',$post);

    That is all that I can see that could be causing the problem.

    BUT, again, this has nothing to do with WordPress, and if you can’t get it figured out form this, you should look for support for whatever library you are using for your system, because it is outside the scope of these forums.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘API issue’ is closed to new replies.