|
![Picture of developer Picture of developer](/graphics/unknown.gif) developer - 2014-10-01 15:11:42
Givinv following error
Error: it was not possible to retrieve the API call: 3 it was not possible to access the file php-oauth.png
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2014-10-01 20:44:14 - In reply to message 1 from developer
The file must exist with that path in the same machine you are running PHP. Does the file exist?
![Picture of developer Picture of developer](/graphics/unknown.gif) developer - 2014-10-07 12:54:00 - In reply to message 2 from Manuel Lemos
Sorry ! File path was not correct.
Thanks!
![Picture of Kim Ball Picture of Kim Ball](/graphics/unknown.gif) Kim Ball - 2015-03-31 21:11:22 - In reply to message 2 from Manuel Lemos
Is there a way to post an image from a remote url instead of a directory on the same server?
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2015-04-01 02:36:25 - In reply to message 4 from Kim Ball
Do you want to attach a file with contents from a remote URL, or do you want to insert the URL of that file in the Twitter post message?
![Picture of Kim Ball Picture of Kim Ball](/graphics/unknown.gif) Kim Ball - 2015-04-01 13:43:38 - In reply to message 5 from Manuel Lemos
$media = "image.png"; //works perfect!
$media = "http://domain/image.png"; //This is what I need!
"https://api.twitter.com/1.1/statuses/update_with_media.json",
'POST', array('status'=>$text,
'media[]'=>$media),array(
'FailOnAccessError'=>true,
'Files'=>array('media[]'=>array()
), $osid,$user);
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2015-04-01 21:42:18 - In reply to message 6 from Kim Ball
$media = "http://domain/image.png";
You can try the latest class version using a call like this:
$success = $client->CallAPI(
"https://api.twitter.com/1.1/statuses/update_with_media.json",
'POST', array(
'status'=>'This is a test tweet to evaluate the PHP OAuth API support to upload image files sent at '.strftime("%Y-%m-%d %H:%M:%S"),
'media[]'=>file_get_contents($media)
),
array(
'FailOnAccessError'=>true,
'Files'=>array(
'media[]'=>array(
'FileName'=>'image.png'
)
)
), $upload);
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2015-04-01 21:53:26 - In reply to message 6 from Kim Ball
Sorry you also need to set the type of parameter to 'Data'
$media = "http://domain/image.png";
$success = $client->CallAPI(
"https://api.twitter.com/1.1/statuses/update_with_media.json",
'POST', array(
'status'=>'This is a test tweet to evaluate the PHP OAuth API support to upload image files sent at '.strftime("%Y-%m-%d %H:%M:%S"),
'media[]'=>file_get_contents($media)
),
array(
'FailOnAccessError'=>true,
'Files'=>array(
'media[]'=>array(
'Type'=>'Data',
'FileName'=>'image.png'
)
)
), $upload);
![Picture of Kim Ball Picture of Kim Ball](/graphics/unknown.gif) Kim Ball - 2015-04-11 14:58:17 - In reply to message 8 from Manuel Lemos
I am still not able to upload the image. Can you explain what should be included in the $upload parameter? in all other examples you use the $user parameter. I do not find any reference to $upload in your API code.
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2015-04-13 04:10:10 - In reply to message 9 from Kim Ball
As explained in the documentation, that last parameter is a variable that is passed by reference to return the response of the request.
You can name it the way you want. In that case, I called it $upload because you are uploading some data, but you may choose some other name.
|