Jump to content

nkosinathi

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Posts posted by nkosinathi

  1. Thanks in advance for help.

    I have a PHP script that has a function called traverseXMLNodes and it passes an xml string. I want anyone with a username and password to be able to call this function from his website or application or programming. In short i want my site to act as an API(Application Programming Interface).

     

    I am really stuck as to how to go about this. There are other functions i would like to call as well so traverseXMLNodes  is not the only function i want to my "API" users to access.

     

    Below is the code I am using. the filename for my php i called remote.php. I am using the following query string to test and no results are returned.

    http://localhost/testfolder/remote.php?xmlstring=20

     

     

    <?php
    $allowedfuncs = array('xmlstring','remotefunction2');
    
    if(in_array($_get['xmlstring'], $allowedfuncs))
    {
        $func = $_get['xmlstring'];
        $output = traverseXMLNodes($func);        // This calls $_get['funccall']()
        echo $output;
    }
    else
    {
        exit();
    }
    
    function traverseXMLNodes ($func) {
    
    echo "The XML string is";
    echo "<br/>";
    echo $func;
    echo "<br/>";
    }
    /*
    More functions go here
    */
    ?>

     

     

     

  2. Thanks again for help

     

    The First URL is http://sendbulksms.co.za/withoutsimplexml.php  This where the server response xml string is displayed (echo XML string) and no use of simplexml library function

     

    The second is http://sendbulksms.co.za/withsimplexmllibrary.php  This where the simplexml library is used. I use the following code

    $xml = simplexml_load_string($xml);	

     

     

    "remove html" meant instead of the  I extracted the XML from the HTML. I then used simplexml_load_file(with the XML from response HTML)  instead of simplexml_load_string on the localhost

     

     

  3. Thanks for trying to help everyone.

     

    I have saved the XML response (Using file save as and remove html) to my localhost and use SimpleXML library on local computer it works fine.

    The problem is when i get the response from other server and try to use SimpleXML on the returned XML response. Please i need this finished before end of year my Manager is breathing down my neck.

  4. Thanks in advance for your help.

    I have the following code

     

    function traverseXMLNodes($xml) 
    {
    $xml = stripslashes($xml);
    $xml =simplexml_load_string("<div>{$xml}</div>");//This the line that makes errors its line 70
    
    
     echo 'Displaying contents of XML file...<br />';
    
        print_r($xml);
    
    }
    
    

     

     

    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : xmlParseCharRef: invalid xmlChar value 0 in /home/wwwsend/public_html/postSample_Reply3.php on line 70 (Where i have written This the line that makes errors)

     

    Warning: simplexml_load_string() [function.simplexml-load-string]: yid><eventid>60387073</eventid><numfrom>27826641429</numfrom><receiveddata>&#x0; in /home/wwwsend/public_html/postSample_Reply3.php on line 70

     

    Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/wwwsend/public_html/postSample_Reply3.php on line 70

     

    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : xmlParseCharRef: invalid xmlChar value 0 in /home/wwwsend/public_html/postSample_Reply3.php on line 70

     

    Warning: simplexml_load_string() [function.simplexml-load-string]: ventid>60387073</eventid><numfrom>27826641429</numfrom><receiveddata>&#x0;O&#x0; in /home/wwwsend/public_html/postSample_Reply3.php on line 70

  5. Hi All

    Thanks in advance for your help.

     

    I want to have to following query string Type=myparam&Username=dazd&Password=nk98830&id=0&Cols_Returned=numfrom,sentdata

     

    But my code returns the following

    Type=myparam&Username=dazd&Password=nk98830&id=0&Cols_Returned=%2F%22numfrom%2F%22%2C%2F%22sentdata%2F%22

     

    Below is the code:

    $data= array(

    "Type"=> "myparam",

    "Username" => "dazd",

    "Password" => "nk98830",

    "id" => "0",

    "Cols_Returned" => '/"numfrom/",/"sentdata/"'

     

    ) ; //This contains data that you will send to the server.

    $data = http_build_query($data); //builds the post string ready for posting

    echo "The Query String is                  ";

    echo $data;

     

     

    Regards

  6. Hi All

     

    I need to write a PHP file/app to use the query string and from the results(query string results) obtained, write a conditional statement. The statement will be either Domain available or Domain Not Available depending on the (query string results and further processing might be needed. 

     

    I have the following query string "Domain=MyDomainName&Enter=Enter" the whole URL and Query String  is

     

    http://www.coza.net.za/cgi-bin/whois.sh?Domain=MyDomainName&Enter=Enter.

     

    I want to be able to echo whether the domain is a Match (Meaning not available for registration on .CO.ZA namespace) or it has NO Match ( I can Register on CO.ZA)

     

    I will have the text box in the Form where the the user will input the desired name and action my PHP script E.G.

     

    <form action="domainchecker.php" method="post" name="domain">

            Domain name:

            <table>

              <tr><td><input name="domainname" type="text" /></td></tr>

              <tr><td><input type="submit" name="submitBtn" value="Check domain"/></td>

            </tr>

            </table> 

          </form>

     

     

    MY Problem is what to put in domainchecker.php to implement this. I have tried socket connection to the whois server but co.za does not have this, I have to use Query strings and I am stuck and pulling my hair off.

     

    Thanks in advance

  7. Hi All,

     

    I hope this is correct forum 4 my question.

     

    I was trying the to test the CelsiusToFahrenheit Web Service on W3schools.com.

    When i try to use the

    http://www.w3schools.com/webservices/tempconvert.asmx/CelsiusToFahrenheit?Celsius=100

     

    I got this syntax from http://msdn.microsoft.com/en-us/library/aa719483(VS.71).aspx

    and the exact syntax is

     

    http://servername/vdir/webservicename.asmx/Methodname?parameter=value

    I get an error when trying to do this? Why, is this happening?

     

  8. I have the code below which manually sets the default (select element default <option>) on the select element to 07:13. I want to use the current time as a default<option>.  I know how to get the current time using PHP, my problem is how to write some for loop or something similar to do this ?

     

    Below is the manual code that sets the current time to 07:13

     

     

     

    $tblString.="<td><select name=\"hour\" id=\"hour\" class=\"TextBoxes\">";

     

    $tblString.="<option value=\"0\">0</option>";

    $tblString .= "<option value=\"1\">1</option>";

        $tblString .= " <option value=\"2\">2</option>";

        $tblString .= " <option value=\"3\">3</option>";

        $tblString .= " <option value=\"4\">4</option>";

        $tblString .= " <option value=\"5\">5</option>";

          $tblString .= " <option value=\"6\">6</option>";

          $tblString .= "<option selected=\"selected\" value=\"7\">7</option>";

          $tblString .= " <option value=\"8\">8</option>";

          $tblString .= " <option value=\"9\">9</option>";

            $tblString .= " <option value=\"10\">10</option>";

              $tblString .= " <option value=\"11\">11</option>";

              $tblString .= " <option value=\"12\">12</option>";

              $tblString .= " <option value=\"13\">13</option>";

              $tblString .= " <option value=\"14\">14</option>";

              $tblString .= " <option value=\"15\">15</option>";

              $tblString .= " <option value=\"16\">16</option>";

              $tblString .= " <option value=\"17\">17</option>";

              $tblString .= " <option value=\"18\">18</option>";

              $tblString .= " <option value=\"19\">19</option>";

              $tblString .= " <option value=\"20\">20</option>";

              $tblString .= " <option value=\"21\">21</option>";

              $tblString .= " <option value=\"22\">22</option>";

              $tblString .= " <option value=\"23\">23</option>";

              $tblString .= " </select> :";

              $tblString .= "<select name=\"minute\" id=\"minute\" class=\"TextBoxes\">";

              $tblString .= " <option value=\"00\">00</option>";

              $tblString .= " <option value=\"01\">01</option>";

              $tblString .= " <option value=\"02\">02</option>";

              $tblString .= " <option value=\"03\">03</option>";

              $tblString .= " <option value=\"04\">04</option>";

              $tblString .= " <option value=\"05\">05</option>";

              $tblString .= " <option value=\"06\">06</option>";

      $tblString .= " <option value=\"07\">07</option>";

      $tblString .= " <option value=\"08\">08</option>";

      $tblString .= " <option value=\"09\">09</option>";

      $tblString .= " <option value=\"10\">10</option>";

      $tblString .= " <option value=\"11\">11</option>";

      $tblString .= " <option value=\"12\">12</option>";

              $tblString .= " <option selected=\"selected\" value=\"13\">13</option>";

              $tblString .= " <option value=\"14\">14</option>";

      $tblString .= " <option value=\"15\">15</option>";

      $tblString .= " <option value=\"16\">16</option>";

      $tblString .= " <option value=\"17\">17</option>";

      $tblString .= " <option value=\"18\">18</option>";

      $tblString .= " <option value=\"19\">19</option>";

      $tblString .= " <option value=\"20\">20</option>";

      $tblString .= " <option value=\"21\">21</option>";

      $tblString .= " <option value=\"22\">22</option>";

      $tblString .= " <option value=\"23\">23</option>";

      $tblString .= " <option value=\"24\">24</option>";

      $tblString .= " <option value=\"25\">25</option>";

      $tblString .= " <option value=\"26\">26</option>";

      $tblString .= " <option value=\"27\">27</option>";

      $tblString .= " <option value=\"28\">28</option>";

      $tblString .= " <option value=\"29\">29</option>";

      $tblString .= " <option value=\"30\">30</option>";

      $tblString .= " <option value=\"31\">31</option>";

      $tblString .= " <option value=\"32\">32</option>";

      $tblString .= " <option value=\"33\">33</option>";

      $tblString .= " <option value=\"34\">34</option>";

      $tblString .= " <option value=\"35\">35</option>";

      $tblString .= " <option value=\"36\">36</option>";

      $tblString .= " <option value=\"37\">37</option>";

      $tblString .= " <option value=\"38\">38</option>";

      $tblString .= " <option value=\"39\">39</option>";

      $tblString .= " <option value=\"40\">40</option>";

      $tblString .= " <option value=\"41\">41</option>";

      $tblString .= " <option value=\"42\">42</option>";

      $tblString .= " <option value=\"43\">43</option>";

      $tblString .= " <option value=\"44\">44</option>";

      $tblString .= " <option value=\"45\">45</option>";

      $tblString .= " <option value=\"46\">46</option>";

      $tblString .= " <option value=\"47\">47</option>";

      $tblString .= " <option value=\"48\">48</option>";

      $tblString .= " <option value=\"49\">49</option>";

      $tblString .= " <option value=\"50\">50</option>";

      $tblString .= " <option value=\"51\">51</option>";

      $tblString .= " <option value=\"52\">52</option>";

      $tblString .= " <option value=\"53\">53</option>";

      $tblString .= " <option value=\"54\">54</option>";

      $tblString .= " <option value=\"55\">55</option>";

      $tblString .= " <option value=\"56\">56</option>";

      $tblString .= " <option value=\"57\">57</option>";

      $tblString .= " <option value=\"58\">58</option>";

      $tblString .= " <option value=\"59\">59</option>";

    $tblString .="</select>";

    $tblString .= "</td>";

        $tblString .="</tr>";

  9. Can anyone please help. I have the following PHP code and it keeps on making syntax errors. I believe because i have to escape the single quote (') but escaping it results in the Javascript NewCal function passing (/) .

     

     

    <?php

    $tblString = '<table>             

          <td height="19">Message date</td>

     

    <!—ERRORS ARE IN THE CODE BELOW---->

     

          <td valign="top"><input type="text" name="schedule_SomeFunc" class="Textbox"><a href="javascript:NewCal('date_schedule ', 'ddmmmyyyy ',false,24)"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date">[/url]</td>

  10. Parse error: syntax error, unexpected '{' in C:\hshome\xxxxxxx\index.php on line 13

     

    <?php

    require_once 'gateway.php';

     

    $firststring = abcde;

    $secondstring = fghij;

    $gateway= new Gateway($firststring , $secondstring);

    $user = $gateway->require_login();

     

    //[todo: change to the following url to your callback url]

    $urltothegateway = "http://sysconsolutions.co.za/vuvuzela";

     

    //catch the exception that gets thrown if the cookie has an invalid session_key in it

    try

    //Below is line 16

    {

      if (!$gateway->api_client->users_isAppAdded())

      {

        $gateway->redirect($facebook->get_add_url());

      }

    } catch (Exception $ex)

    {

      //this will clear cookies for your application and redirect them to a login prompt

      $gateway->set_user(null, null);

      $gateway->redirect($urltothegateway);

    }

    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.