-3

When I'll upload my .php I get these error:

Parse error: syntax error, unexpected T_STRING in /users/allybong/www/twitteroauth/twitteroauth/twitteroauth.php on line 201

The script of line 197 - 231:

  function http($url, $method, $postfields = NULL) {
$this->http_info = array();
$ci = curl_init()
/* Curl settings */
curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent)
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout)
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout)
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE)
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'))
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer)
curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'))
curl_setopt($ci, CURLOPT_HEADER, FALSE)

switch ($method) {
  case 'POST':
    curl_setopt($ci, CURLOPT_POST, TRUE);
    if (!empty($postfields)) {
      curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
    }
    break;
  case 'DELETE':
    curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
    if (!empty($postfields)) {
      $url = "{$url}?{$postfields}";
    }
}

curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
$this->http_info = array_merge($this->http_info, curl_getinfo($ci));
$this->url = $url;
curl_close ($ci);
return $response;

}

These is a script for a Twitter "BongBot". I get it from https://github.com/lizconlan/bongbot .

Jocelyn
  • 11,209
  • 10
  • 43
  • 60

2 Answers2

3

There are a lot of missing semicolons on the lines you pasted. That is probably the reason it gives you a T_STRING error.

Tom van der Woerdt
  • 29,532
  • 7
  • 72
  • 105
3

After and including the following line, none of your lines end with a semicolon:

$ci = curl_init()

Try adding one to the following lines and it should resolve your issue:

$ci = curl_init();
/* Curl settings */
curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
curl_setopt($ci, CURLOPT_HEADER, FALSE);
newfurniturey
  • 37,556
  • 9
  • 94
  • 102
  • Hello! Now i get a "undefined function" at "curl_init" and "curl_setopt". But why? – AUT_Markus Jan 08 '13 at 16:34
  • @AUT_Markus Sounds like you don't have curl enabled in PHP. You'll have to make sure you have the extension installed and configured to use it. – newfurniturey Jan 08 '13 at 16:37
  • Oh. I'm a idiot. :'D Thanks for all! :) – AUT_Markus Jan 08 '13 at 16:38
  • New Problem. Now i get the error Warning: file_get_contents(last_update) [function.file-get-contents]: failed to open stream: No such file or directory in /home/u124515119/public_html/schedule_me.php on line 12 Line: $last_tweet = explode(".", file_get_contents ("last_update")); I don't know why... – AUT_Markus Jan 08 '13 at 17:59
  • @AUT_Markus Does the file `last_update` actually exist in the `/home/u124515119/public_html` directory? If not, there's your problem. If it does, it probably has permission problems; try updating it with `chmod 0774 last_update`. – newfurniturey Jan 08 '13 at 18:02