Skip to content

Instantly share code, notes, and snippets.

@ishansharma
Created May 9, 2017 06:13
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 ishansharma/62c8858ec05e9716b690923d96360cfd to your computer and use it in GitHub Desktop.
Save ishansharma/62c8858ec05e9716b690923d96360cfd to your computer and use it in GitHub Desktop.
Setting an User Agent with curl
<?php
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($this->data));
curl_setopt($ch, CURLOPT_USERAGENT, 'Name of your service'); // this is where user agent is set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment