0

I want to send the following header using curl:

curl -H 'Authorization: OAuth oauth_signature_method="PLAINTEXT",⤦
⤥oauth_consumer_key="xxx",oauth_token="xxx",oauth_signature="xxx"' ⤦
⤥'https://external.ningapis.com/xn/rest/apiexample/1.0/Photo/recent⤦
⤥?xn_pretty=true&fields=image.url,title&count=2'

Above command is for command line usage. Anyone know how to execute this using PHP curl?

1
  • Are these your real keys, I wonder... ) Commented Aug 22, 2012 at 10:49

1 Answer 1

3

The -H from curl command-line is CURLOPT_HTTPHEADER in PHP curl curl_setopt.

This should be the most basic example for what you need:

$auth = 'Authorization: YOUR_KEYS';
$url  = 'https://external.ningapis.com/xn/rest/apiexample/1.0/Photo/recent?xn_pretty=true&fields=image.url,title&count=2';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array($auth));
curl_exec($ch);
curl_close($ch);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.