php - Outputting data from flat file in XML String -


i have sms api script i'm modifying in order import flat files containing list of phone nos, arranged line line. have problem trying declare data in array such each phone no on separate line tags enclosed between them.

this code below works outputting data (numbers.txt) flat file.

$lines = file("path/to/file/numbers.txt"); foreach($lines $line) {     echo "<gsm>".$line."</gsm> \n" ; } 

however when tried embed array output in xml code below using $xmlstring function, doesn't work. wrong , i'm stuck.

    $xmlstring='             <sms>                <authentication>                   <username>'.$user.'</username>                   <password>'.$pass.'</password>                </authentication>                <message>                   <sender>'.$sender.'</sender>                   <text>'.$message.'</text>                   <recipients> /////////////////////here appears stuck///////////////////  foreach($lines $line) { $xmlstring.="<gsm>".$line."</gsm>"; }     $xmlstring.=' //////////////////////////////////////////////                    </recipients>'                </message>             </sms>';       $fields = "xml=" . urlencode($xmlstring); 


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -