Skip to content

Instantly share code, notes, and snippets.

@LordZombi
Created October 18, 2013 13:01
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 LordZombi/7041211 to your computer and use it in GitHub Desktop.
Save LordZombi/7041211 to your computer and use it in GitHub Desktop.
Curl
$server = $this->getRequest()->getServer();
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 90); // times out after 90s
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, $server['HTTP_USER_AGENT']);
$result = curl_exec($curl);
if(!$result){
$this->_helper->log()->err(curl_error($curl));
$this->view->messenger()->addError($this->view->t('Error accessing payment service.'));
}
curl_close ($curl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment