Skip to content

Instantly share code, notes, and snippets.

@morozVA
Last active March 20, 2018 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morozVA/9c78057add32906a9ee429cf5b1a32bf to your computer and use it in GitHub Desktop.
Save morozVA/9c78057add32906a9ee429cf5b1a32bf to your computer and use it in GitHub Desktop.
php curl
$url = "https://online.moysklad.ru/api/remap/1.1/report/stock/all?&limit=100&offset=".$offset;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "api@media-group : pass");
$result = curl_exec($ch);
curl_close($ch);
$array = json_decode($result, true);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://events.sendpulse.com/events/id/id');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
"email": "'.$_POST['email'].'",
"phone": "'.$_POST['phone'].'",
"product_name": "'.$_POST['product_name'].'",
"product_id": '.$_POST['product_id'].',
"product_price": "'.$_POST['product_price'].'",
"event_date": "'.$_POST['event_date'].'"
}');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$out = curl_exec($ch);
curl_close($ch);
echo $out;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment