There are a few status updates on @cltag that are fairly similar. If
you're posting the same tweet multiple times twitter will only accept
the first tweet and ignore the rest. To test this add a timestamp at
the end of each tweet like this "status=$mensaje".time() and try

Instead of checking for an empty buffer you may want to use $info =
curl_getinfo($curl_handle) after curl_exec() and check out that $info
array. More specifically $info['http_code']. That will make debugging
this and other issues a little easier for you.

On Aug 25, 3:08 pm, onelix <> wrote:
> Hi, im using API REST for update data from a bot (@cltag), the script
> works fine, but, only sometimes update the timeline.
> When i run manually the php script it works perfectly one time, but it
> doesnt do it anymore in one  hour or two.
> It use the TwitterSearch.php library. this is a piece of my code.
> function twittear($mensaje){
>         $username = 'cltag';
>         $password = 'password';
>         $url = '';
>         $curl_handle = curl_init();
>         curl_setopt($curl_handle, CURLOPT_URL, "$url");
>         curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
>         curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
>         curl_setopt($curl_handle, CURLOPT_POST, 1);
>         curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$mensaje");
>         curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
>         $buffer = curl_exec($curl_handle);
>         curl_close($curl_handle);
>         if (empty($buffer)) {
>                 echo 'Error: mensaje vacio';
>         } else {
>                 echo 'Ultimo Twitt a '.$username.':<br> '.$mensaje;
>         }
> }
> and then i call from another php script this funcion (the $mensaje is
> a string with 5 hashtags from TwitterSearch.php).
> Thanx!, and sorry but english is not my first language.

Reply via email to