php - Need to place variable into dynamic URI -
i need place variable $thecompany
end of uri voiceuri on twilio. can see below i've managed create variable can't figure how put uri. when submit page voiceuri field in twilio www.ourdomain.com/.xml
.
the same true xml file i'm trying create saves $thecompany.xml
the code below, appreciated!
here's line i'm using populate voiceuri in twilio:
'voiceurl' => "http://www.ourdomain.com/$thecompany.xml",
and here's line i'm using save xml file new name/ same name passed previous twilio
$doc->save('"$thecompany".xml');
it's simple isn't normal game, i'm more on infusionsoft side of things code , web guy on honeymoon!
appreciate assistance!
--edit--
thanks answers far, unfortunately don't seem working. here's full code php xml creator:
<?php session_start(); ?> <?php $thecompany = $_session['company']; $doc = new domdocument( ); $ele = $doc->createelement( 'root' ); $ele->nodevalue = 'this call $_session["company"] press key accept call'; $doc->appendchild( $ele ); $doc->save("$thecompany.xml"); ?>
i need getting $thecompany url on buy number php page seen below.
<?php session_start(); ?> <?php // line loads library require('services/twilio.php'); $thecompany = $_session['company']; $account_sid = 'ac7841a99c892xxxbc8f7xxx'; $auth_token = 'a71cxx052080xx'; $client = new services_twilio($account_sid, $auth_token); $phonenumber = $client->account->incoming_phone_numbers->create(array( 'phonenumber' => $_session["number"], 'voiceurl' => "http://www.ourdomain.com/"'$thecompany .'".xml", )); echo $phonenumber->sid; ?>
the pages follow so:
1) have php page find available numbers. page passes information onto php page (code directly above one) 2) page buys number , adds account along voiceuri , once submitted page passes xml creator page
i have feeling should switch buy , xml pages around search number create xml file buy number not sure if matters?
thanks sticking me!
--edit #2--
hi guys, sorry know you're helping best can. i'm still having trouble i'm thinking might best create xml file , pass variable php file sends info twilio. if create xml $doc->save($thecompany.'.xml');
how pass variable next page in place of $doc->save($thecompany.'.xml');
?
i think makes more sense create variables add them in place of uri attempting hybrid of static , dynamic.
so i'd looking @ this:
$phonenumber = $client->account->incoming_phone_numbers->create(array( 'phonenumber' => $_session["number"], 'voiceurl' => $thexml, ));
do think that's better option route i'm taking now?
use this
$doc->save($thecompany.".xml");
Comments
Post a Comment