Tweet image along with the text, PHP Not working now


I am using twitter api to tweet image along with the text, before it was working fine but suddenly it is showing blank page on callback.php file. Below is the code I am using please help me in fixing this.

      require 'config.php';
      require 'tmhOAuth.php';
      require 'tmhUtilities.php';
      /// retrive temp access token from cookie 
        $token = $_COOKIE['Temp_Token'];
        $secret = $_COOKIE['Temp_Secret'];
        $img = $_COOKIE['Img_Url'];
        $txt = $_COOKIE['Tweet_Txt'];
      $tmhOAuth = new tmhOAuth(array(
       'consumer_key'    => API_KEY,
        'consumer_secret' => API_SEC,
        'user_token'      => $token,
        'user_secret'     => $secret,	
        'curl_ssl_verifypeer'   => false
        /// Ask Twitter for correct access token 
       $tmhOAuth->request("POST", $tmhOAuth->url("oauth/access_token", ""), array(  
            // pass the oauth_verifier received from Twitter  
            'oauth_verifier'    => $_GET["oauth_verifier"], 'oauth_token' => 	$_GET["oauth_token"]	
        $response = $tmhOAuth->extract_params($tmhOAuth->response["response"]);
    	$tmhOAuth->config["user_token"] = $response['oauth_token'];  
        $tmhOAuth->config["user_secret"] = $response['oauth_token_secret']; 
       $code = $tmhOAuth->request('POST', '', array('media[]'  => "@{$img}", 'status'   => "$txt"), true, true);
    if ($code == 200){
    	  echo '<h1>Your image tweet has been sent successfully</h1>';
          // display the error 

displaying output is zero. I am unable to find where exactly the problem is. Thanks in advance


Please some can tell me, Is this twitter api is working?


Not sure whether you’ve seen the other thread about media uploads, but the update_with_media update endpoint is deprecated and we are moving to the dedicated upload endpoint. Apparently the codebird PHP library works well with this.


Hi Andypiper, Thank you for your reply. Where I can check “moving to the dedicated upload endpoint” when it is done. Thank once again.


You can learn more about uploading media in our docs.