Note that there are some explanatory texts on larger screens.

plurals
  1. POTwilio api parse error: unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'
    primarykey
    data
    text
    <p>I have PHP 5.4.21</p> <p>I'm using a Twilio API that works fine from a browser but in command line mode, I get the following error:</p> <pre><code>&lt;b&gt;Parse error&lt;/b&gt;: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in &lt;b&gt;sms/Services/Twilio.php&lt;/b&gt; on line &lt;b&gt;36&lt;/b&gt; </code></pre> <p>Line 36 of the specified file is part of the following class, please see my note where I specify Line 36.</p> <p>I added all lines of code leading up to and immediately after Line 36 for context, based on some initial feedback requests to show these lines.</p> <pre><code>&lt;?php function Services_Twilio_autoload($className) { if (substr($className, 0, 15) != 'Services_Twilio') { return false; } $file = str_replace('_', '/', $className); $file = str_replace('Services/', '', $file); return include dirname(__FILE__) . "/$file.php"; } spl_autoload_register('Services_Twilio_autoload'); /** * Create a client to talk to the Twilio API. * * * :param string $sid: Your Account SID * :param string $token: Your Auth token from * twilio.com/user/account * :param string $version: API version to use * :param $_http: A HTTP client for making requests. * :type $_http: :php:class:`Services_Twilio_Http` * :param int $retryAttempts: * Number of times to retry failed requests. Currently only idempotent * requests (GET's and DELETE's) are retried . */ class Services_Twilio extends Services_Twilio_Resource { /* this is Line 36... */ const USER_AGENT = 'twilio-php/3.12.0'; protected $http; protected $retryAttempts; protected $last_response; protected $version; protected $versions = array('2008-08-01', '2010-04-01'); public function __construct( $sid, $token, $version = null, Services_Twilio_TinyHttp $_http = null, $retryAttempts = 1 ) { $_http = new Services_Twilio_TinyHttp( "https://api.twilio.com", array("curlopts" =&gt; array( CURLOPT_USERAGENT =&gt; self::USER_AGENT, CURLOPT_HTTPHEADER =&gt; array('Accept-Charset: utf-8'), CURLOPT_CAINFO =&gt; dirname(__FILE__) . '/cacert.pem', )) ); } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload