xml - How to create a CSV download in Php -
I need people with some help, I am pulling data from the CRM using APIs and I am going through the medium of each variable I am looping from The answers given below are completely okay when it is isolated inside Wordpress. For
($ x = 0; $ x & lt; = $ total_leads; $ x ++) {$ first_name = $ xml- & gt; Users & gt; User [$ x] - & gt; Firstname; $ Last_name = $ xml- & gt; User- & gt; User [$ x] - & gt; Lastname; $ Company_name = $ xml- & gt; User- & gt; User [$ x] - & gt; company; }
The data that I have to do is to add that data to someone. Push into a Csv file and download it. I have tried various examples here and I have no luck. It seems that the data should be stored in an array. Any suggestions?
Update:
'header (' content-type: text / plain '); Header ('content-dispute: attachment; file name = sample ccv'); ($ X = 0; $ x & lt; = $ total_leads; $ x ++) {$ first_name = $ xml- & gt; User- & gt; User [$ x] - & gt; first name; $ Last_name = $ xml- & gt; User- & gt; User [$ x] - & gt; Lastname; $ Company_name = $ xml- & gt; User- & gt; User [$ x] - & gt; company; $ Gmg_data = $ First_name ',' $ Last_name ',' $ Company_name '\ N'; $ Fp = fopen ('php: // output', 'w'); Forex currency ($ gmg_array as $ line) {fputcsv ($ fp, $ line); }} `
is not making the file yet
Update: 11/04/14 - 11:05 AM
Past fewer results The given line of code and added
`$ gmg_data [] = array ($ first_name, $ last_name, $ company_name); $ Fp = fopen ('php: // output', 'w'); Forex currency ($ gmg_array as $ line) {fputcsv ($ fp, $ line); } `
I still can not find the .csv download. I appreciate all your help, but how is it being marked as closed subject?
& lt; ? Php // You represent the serial that you have in the CSV $ data = array (array 'A', 'B', 'C'), array ('1', '2', '3'), array Want to change ('4', '5', '6')); Header ('content-type: text / plain'); Header ('content-dispute: attachment; file name = sample ccv'); $ Fp = fopen ('php: // output', 'w'); // loops through this array, although if you are pulling the data row from somewhere from the // line then the variable $ line is only relevant as a $ / in this example Forex currency ($ data as $ line) {fputcsv ($ fp, $ line); }
Comments
Post a Comment