cURL PHP request and download output -


How can I use a CRL command, to create a PSP request in the output table data in a .csv file and then Have you got ready to download that file? So far I have:

PHP

  if (isset ($ _GET ['FROMCURL'])) {if (isset ($ _ GET ['table' ])) {$ Table = $ _GET ['Table']; } If ($ _GET ['FROMCURL'] == "test") {dump_data ($ db, $ table); }} Function dumpet ($ db, $ table) {$ tables = array ("x", "y", "z"); If (in_array ($ table, $ tables)) {try $ $ dumpData = $ db- & gt; ("SELECT * FROM $ table"); $ DumpData- & gt; Executed (); $ Data = fopen ('../$ Table _'. Time (). 'Csv', 'a'); While ($ line = $ dumdata-> fetch (pdo: FETCH_ASSOC)) {$ csv = array (); Forex currency ($ key as $ $ line => $ val) {if ($ key! = 'X_blob' || $ key! = 'Y_blob' || $ key! = 'Z_blob') {$ csv [] = $ Val. ','; }} Fputcsv ($ data, $ csv); }} Hold (PDOException $ e) {echo $ e-> GetMessage (); }}}   

I think the curl command is somethnig such as

  curl http://www.website.com/php/tables.php? FROMCURL = Test & amp; Table = x   

I'm not sure how to download the file now

Use the curl to get the content as it obtains the method

  $ ch = curl_init (); Curl_setopt ($ CH, CURLOPT_URL, "http://www.website.com/php/tables.php?FROMCURL=test&table=x"); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); Echo curl_exec ($ ch); // feedback return curl_close ($ ch);    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -