XML + PHP - WHMCS API. ***Noob***

Discussion in 'PHP' started by connorml, Nov 3, 2012.

  1. #1
    Okay So basicly here is the code:

    
    
    <?php
     
    $url = "http://www.****.com/billing/includes/api.php";
    $username = "*****";
    $password = "*****";
     
    $postfields["username"] = $username;
    $postfields["password"] = $password;
    $postfields["action"] = "gettickets"; 
    $postfields["status"] = "Awaiting Reply";
     
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 100);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     $xml = curl_exec($ch);
     
                        ?>
    
    
    Code (markup):
    Okay, So Im using the WHMCS API, and I want it to display totalresults part.

    The API details are here:
    http://docs.whmcs.com/API:Get_Tickets

    Thanks

    Connor
     
    connorml, Nov 3, 2012 IP
  2. connorml

    connorml Greenhorn

    Messages:
    94
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    20
    #2
    Any one? Please
     
    connorml, Nov 4, 2012 IP
  3. connorml

    connorml Greenhorn

    Messages:
    94
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    20
    #3
    Anyone? Please help me
     
    connorml, Nov 4, 2012 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #4
    I'm not sure what your code has to do with the API page, though sending values to a undefined variable as array indexes can have unforseen consequences...

    Though I didn't think 0 was a valid value for CURLOPT_SSL_VERIFYHOST or VERIFYPEER, or at the very least was bad/piss poor security... are you forgetting to MD5 the PW since WHMCS' examples show to do that? Also, doesn't addinvoicepayment require an 'amount' value?

    Also, what errors is it outputting/reporting? It's not entirely clear what you are even asking for.
     
    deathshadow, Nov 4, 2012 IP
  5. richj

    richj Member

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36