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

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -