Skip to content

Instantly share code, notes, and snippets.

@Pum-purum
Created July 23, 2019 12:10
Show Gist options
  • Save Pum-purum/98d62e3eee44286187a3d8ab9a9d22f2 to your computer and use it in GitHub Desktop.
Save Pum-purum/98d62e3eee44286187a3d8ab9a9d22f2 to your computer and use it in GitHub Desktop.
curl php
$method = '/add.new.ajax';
$params = ['field' => 'value'];
$queryUrl = 'https://mycoolsite.ru' . $method;
$queryData = http_build_query($params);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
CURLOPT_VERBOSE => 1));
$result = curl_exec($curl);
curl_close($curl);
$result = json_decode($result, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment