Reputation: 4962
A PHP Error was encountered
Severity: Notice
Message: Uninitialized string offset: 0
Filename: index.php
Line Number: 154
here is the code
if ( $stCurlHandle !== NULL )
{
curl_setopt($stCurlHandle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($stCurlHandle, CURLOPT_TIMEOUT, 12);
$sResult = @curl_exec($stCurlHandle);
if ($sResult[0]=="O") //line number 154
{$sResult[0]=" ";
// echo $sResult; // Statistic code end
}
curl_close($stCurlHandle);
}
Upvotes: 0
Views: 4763
Reputation: 482
If there is a chance that $sResult is returning false, which is a boolean and not a string or an array. Try changing the conditional to:
if ($sResult !== FALSE && $sResult[0]=="O") {$sResult[0]=" ";}
Upvotes: 0
Reputation: 1831
$sResult is not having offset zero. try to do
print_r($sResult);
before line 154 , and you will find out the error reason and solution.
Upvotes: 0
Reputation: 10964
It's likely returning false
from a failed request. You should make that one of your test cases before testing for actual results.
Upvotes: 0
Reputation: 13755
curl_exec
doesn't return an array, just raw data in a string ... if you need the first character of the string you can use
$sResult{0}
Upvotes: 2