dillondoyle Posted July 13, 2010 Share Posted July 13, 2010 I am new to PHP and am really stuck. I need to POST a few variables and can't seem to get it to work (I'm using the Twillio REST API). Here is where the data I need POSTed is generated: while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { printf("vanID: %s FirstName: %s Phone: %s Called: %s", $row["vanID"], $row["FirstName"], $row["Phone"], $row["Called"]); $response = $client->request("/$ApiVersion/Accounts/$AccountSid/Calls", "POST", array( "Caller" => $number, "Called" => $row["Phone"], "FirstName" => $row["FirstName"], "Url" => $url . 'callback.php?number=' . $_REQUEST['called'] . 'firstname=' . $_REQUEST['FirstName'] )); if($response->IsError) { $err = urlencode($response->ErrorMessage); die; } } It is then sent to the following: <?php header("content-type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <Response> <Say>Hello <?php echo $_POST['FirstName'];?>!</Say> <Pause length="1"/> <Hangup/> </Response> Any ideas on why this isn't working? Like I said, I'm just learning PHP so it's probably a really simple solution! Thanks in advanced for any help!! Link to comment https://forums.phpfreaks.com/topic/207659-help-_request-in-an-array/ Share on other sites More sharing options...
Pikachu2000 Posted July 13, 2010 Share Posted July 13, 2010 Are these two code chunks in the same script? Link to comment https://forums.phpfreaks.com/topic/207659-help-_request-in-an-array/#findComment-1085575 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.