skip to Main Content

CURL command as a PHP script

I am trying to convert this CURL command: curl -i https://myurl >toto.txt into a PHP script, but it doesn't work. $ch_rech = curl_init(); curl_setopt($ch_rech, CURLOPT_URL, "https://myurl"); curl_setopt($ch_rech, CURLOPT_HEADER, 0); ob_start(); curl_exec($ch_rech); curl_close($ch_rech); $Results = ob_get_contents(); ob_end_clean(); How can I do…

VIEW QUESTION

How to parse nested json to csv using command line

I want to parse a nested json to csv. The data looks similar to this. {"tables":[{"name":"PrimaryResult","columns":[{"name":"name","type":"string"},{"name":"id","type":"string"},{"name":"custom","type":"dynamic"}]"rows":[["Alpha","1","{"age":"23","number":"xyz"}]]]} I want csv file as: name id age number alpha 1 23 xyz I tried: jq -r ".tables | .[] | .columns | map(.name)|@csv"…

VIEW QUESTION
Back To Top
Search