dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHP/cURL/ Tropo

  1. #1
    Join Date
    Sep 2010
    Posts
    30

    Cool PHP/cURL/ Tropo

    Hi everyone, need some help with Tropo-API related issue using php, cURL. I'm not entirely sure if TROPO is ready for prime-time but I thought I would ask some of you here. The idea is simple a have a small user form:

    ---------------------------------------------------------------
    <form action="process.php" method="post" name="form" id="form">
    <!--form class="form" method="post" action=""-->
    <input type="hidden" name="action" value="create" />
    <input type="hidden" name="token" value="" />
    <input type="hidden" name="custCellNum" name="custCellNum" id="custCellNum" value=""/>
    <input type="hidden" value = "" name=""/>
    <div class="namefield"><input type="text" placeholder="Your Full Name:" class="text requiredField transparent_class" id="customerName" name="customerName" size="14px" value="" /></div>
    <!--div class="phoneac"><input type="text" placeholder="Area Code:" class="text requiredField transparent_class" id="phoneac" name="phoneareacode" size="7px"value="" /></div-->
    <div class="phonenumber"><input type="text" placeholder="Phone Number:" class="text requiredField transparent_class" id="numToDial" name="numToDial" size="11px"value=""/></div>
    <div class="themessage"><input type="text" placeholder="Your Text Message (60 characters maximum):" class="text requiredField transparent_class" name="maxcharfield" id="msg" size="36px" value="" onKeyDown="textCounter(this,'progressbar1',60)"
    onKeyUp="textCounter(this,'progressbar1',60)"
    onFocus="textCounter(this,'progressbar1',60)" /></div>
    <div id="progressbar1" class="progress"></div>
    <script>textCounter(document.getElementById("maxcharfield"),"progressbar1",60)</script>
    <div class="sendbutton">
    <input name="Submit1" type="submit" value="send" class="transparent_class" style="height: 28px" /></div>
    </form>
    ---------------------------------------------------------------

    which takes in a name, phone number and a message which then posts to: PROCESS.PHP

    ---------------------------------
    <?php
    #include "url.h"
    $token = '';
    $numbertodial = '';
    $msg = 'msg';
    $numToDial = 'numToDial';

    $curl_handle = curl_init();
    curl_setopt($curl_handle,CURLOPT_URL,'http://api.tropo.com/1.0/sessions?action=create&token='.$token.'&numbertodial='.$numbertodial.'&msg='.$msg. '&numToDial='.$numToDial);
    curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
    curl_exec($curl_handle);
    curl_close($curl_handle);
    ?>
    ------------------------------

    Works great, text message get's sent and received.

    HOWEVER. Tropo then sends a

    success=true&token=

    which I have the option to save. But what I really want to do is 1. suppress this message and 2. send a message / open another php file in the parent window where the form should be. Here's the test link:

    http://testserver.aosystemsgroup.com/ClickToCall.html

    thanks!

  2. #2
    Join Date
    Oct 2013
    Posts
    11
    the functionality of a Drupal website to include Tropo service. I absolutely need to be able to access my Drupal database and the API that Drupal provides me for its own workings. I am fairly new at writing Drupal modules, but what seems to be happening right now is that Tropo cannot recognize my .module file as PHP, so it does not receive the JSON calls necessary.

    I need either a) a way of getting Tropo to read from my .module file or b) a way of adding a regular .php file to my module such that I can still make all normal Drupal function calls AND Tropo can access my script.

    Thoughts?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles