I'll be honest I'm not 100% knowledgeable with cURL
However I am looking to use it to post an tweet with an image attached to it using Twitters API.
I've got my server script setup to output any $_GET variables. However the array is outputting as blank, So I'm assuming my cURL isnt posting properly.
My PHP code is as follows :
$url = 'http://www.website.com/tweet.php';
$myvars = 'access_token=' . $access_token . '&access_token_secret=' . $access_token_secret . '&message=' . $message . '&image=' . $image;
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
output($response);
The $response is returning an error from the Twtter API :
[message] => Your credentials do not allow access to this resource
If I run the URL with all credentials in it in my browser, It works without issue.
Am I missing an additional curl_setopt ?
Cheers