Skip to content

Instantly share code, notes, and snippets.

View stis91's full-sized avatar
๐Ÿ˜‡
Working from home

stis91

๐Ÿ˜‡
Working from home
View GitHub Profile
@stis91
stis91 / php-curl-post.php
Created January 29, 2020 12:45 — forked from 6ui11em/php-curl-post.php
PHP: Curl post and write to file
$ch = curl_init($post_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('data1'=>'val','data2'=>'val2')));
$data_str = curl_exec($ch);
curl_close($ch);
file_put_contents($path_to_xml_data,$data_str);