Skip to content

Instantly share code, notes, and snippets.

@marcosnakamine
Created February 15, 2017 18:13
Show Gist options
  • Save marcosnakamine/b5ab761867a5d73430ffa8e72d1fd80e to your computer and use it in GitHub Desktop.
Save marcosnakamine/b5ab761867a5d73430ffa8e72d1fd80e to your computer and use it in GitHub Desktop.
PHP - Sending header in cURL
<?php
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, 'http://url.com' );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/xml' ) );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
curl_close( $ch );
var_dump( $output );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment