Hi,
I am trying to upload twitter ids list to a csv file in ta_partner.
The following twurl command works fine:
twurl -t -H ton.twitter.com /1.1/ton/bucket/ta_partner -X POST -A "X-TON-Expires: Sat, 10 Nov 2015 23:01:50 GMT" -A "Content-Type: text/csv" -A "Content-Length: 0" --data "100000075"
I am getting a 201 Created. with location in the header.
I am trying to upload the same from PHP CURL
I took the Authorization header , and copy pasted it - just to check that the same POST command works, and it fails.
response is 403 Forbidden,
PHP CURL:
$ci = curl_init();
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_HTTPHEADER, array(
'Content-Type: text/csv',
'Content-Length: 0',
'Authorization: **< COPY from working twurl POST >**,
'X-TON-Content-Type: text/csv',
'X-TON-Content-Length: 9',
'X-TON-Expires: '. date('D, d M Y H:i:s T', strtotime("+6 day")),
));
curl_setopt($ci, CURLOPT_HEADER, true);
curl_setopt($ci, CURLOPT_VERBOSE, true);
$fp = fopen('/tmp//errorlog.txt', 'w');
curl_setopt($ci, CURLOPT_STDERR, $fp);
curl_setopt($ci, CURLOPT_POST, TRUE);
curl_setopt($ci, CURLOPT_POSTFIELDS, "100000075");
curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
What am i doing wrong? I am sending the exact same thing in twurl and it works.