Me and all my live contact are stunned by phenomenom where a variable value changes in other side ow while. Before 2nd loop value is correct, but inside 2nd loop value is incorrect.
Here's the actual code.
try {
$yhteys = new PDO('mysql:host=localhost;dbname=XXXX', 'YYYY', 'ZZZZ');
} catch (PDOException $e) {
die("VIRHE: " . $e->getMessage());
}
$yhteys->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$yhteys->exec("SET NAMES utf8");
$kysely = $yhteys->prepare('SELECT viite FROM hakija WHERE vaihe = 1 ');
$kysely->execute();
$file = fopen("tilit.csv","r");
while(! feof($file)) {
$tilirivi=fgetcsv($file,100,";");
if ($tilirivi[4] < 0) continue;
$viiteviesti = substr($tilirivi[3], 1);
//print "Viiteviesti1: $viiteviesti\n"; produces correct print
while ($rivi = $kysely->fetch()) {
//print "Viiteviesti2: $viiteviesti\n"; produces incorrect print
$kantaviite=$rivi["viite"];
if ($viiteviesti == $kantaviite ) {
$asetus = $yhteys->prepare("UPDATE hakija SET vaihe=2 WHERE viite='$viiteviesti' ");
$asetus->execute();
}
}
}
How is this possible and how should I correct my code?
'column' is a reserved variable name according to this article:
http://hockinson.com/programmer-web-designer-denver-co-usa.php?s=43
which might cause unexpected results.
It came up that for some reason $kysely-fecth() didn't return any content. I got the code working and here's solution:
try {
$yhteys = new PDO('mysql:host=localhost;dbname=XXXX', 'YYYY', 'ZZZZ');
} catch (PDOException $e) {
die("VIRHE: " . $e->getMessage());
}
$yhteys->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$yhteys->exec("SET NAMES utf8");
$kysely = $yhteys->prepare('SELECT viite FROM hakija WHERE vaihe = 1 ');
$kysely->execute();
$kysely->setFetchMode(PDO::FETCH_NUM);
$result = $kysely->fetchAll();
$file = fopen("tilit.csv","r");
while(! feof($file)) {
$tilirivi=fgetcsv($file,100,";");
if ($tilirivi[4] < 10) continue;
$viiteviesti = substr($tilirivi[3], 1);
foreach ($result as $rivi) {
foreach ($rivi as $kantaviite) {
if ($viiteviesti == $kantaviite ) {
$asetus = $yhteys->prepare("UPDATE hakija SET vaihe=2 WHERE viite='$viiteviesti' ");
$asetus->execute();
}
}
}
}
Related
I created a script to import a CSV file. When I run it by hand with the php command on the server the script runs without problems. On the other hand when the crontab execute it there is an error:
SPLFILEOBJECT::__CONSTRUCT(IMPORTS/STOCK_EXPRESS_FR.CSV): FAILED TO
OPEN STREAM: NO SUCH FILE OR DIRECTORY .
Here is my import script.
<?php
require(dirname(__FILE__) . '/config/config.inc.php');
$dir_fichier = 'IMPORTS/STOCK_EXPRESS_FR.csv';
//error_reporting(E_ALL);
ini_set('display_errors', 0);
tntProduct($dir_fichier);
function tntProduct($dir_fichier)
{
$errors = [];
try{
$csv = new SplFileObject($dir_fichier);
$csv->setFlags(SplFileObject::READ_CSV);
$csv->setCsvControl(';');
} catch (Exception $exception) {
$errors[] = $exception->getMessage();
}
$nbProducts = 0;
$nbProductsSuccess = 0;
foreach ($csv as $ligne) {
if ($ligne[1] === '0') {
$result = getIdsProducts($ligne[0]);
if (!empty($result)) {
foreach ($result as $key => $item) {
$nbProducts++;
try {
setCarrier($item['id_product']);
$nbProductsSuccess++;
}catch (Exception $exception) {
$errors[] = $exception->getMessage();
}
}
}
}
}
if (count($errors)>0) {
sendMail($errors);
} else {
sendMail($nbProducts);
}
if (file_exists ($dir_fichier)) {
unlink($dir_fichier);
}
}
function getIdsProducts($ref)
{
$sql = Db::getInstance()->executeS('
SELECT p.id_product
FROM ' . _DB_PREFIX_ . 'product p
WHERE p.reference = ' . '"' . $ref . '"');
return $sql;
}
function setCarrier($productId)
{
$shop = 1;
$carriersFR = [
0 => 1,
1 => 72,
2 => 87
];
$products = new Product((int)$productId, false, 1, $shop);
$products->setCarriers($carriersFR);
}
function sendMail($result)
{
$data['{message}'] = $result;
Mail::Send(
1,
'tnt_fr',
'Mise à jour TNT France',
$data,
'test#test.fr',
'test',
null,
null,
null,
true,
_PS_MAIL_DIR_,
false,
1
);
}
Do you have an idea of the problem ? Thank you for your help
In crontab run the script, is not be in the folder, so you need to write full path or correct relative path.
I am use mgp25/Instagram-API
How can l get my instagram posts with the likes of a particular user?
My code:
set_time_limit(0);
date_default_timezone_set('UTC');
require __DIR__.'/vendor/autoload.php';
$username = 'myInstagramUsername';
$password = 'myInstagramPassword';
$debug = false;
$truncatedDebug = false;
$ig = new \InstagramAPI\Instagram($debug, $truncatedDebug);
try {
$ig->login($username, $password);
} catch (\Exception $e) {
echo 'Something went wrong: '.$e->getMessage()."\n";
exit(0);
}
try {
$userId = $ig->people->getUserIdForName($username);
$act = json_encode($ig->people->getRecentActivityInbox(), true);
???????
} catch (\Exception $e) {
echo 'Something went wrong: '.$e->getMessage()."\n";
}
Worked
set_time_limit(0);
date_default_timezone_set('UTC');
require __DIR__.'/vendor/autoload.php';
$username = 'username';
$password = 'password';
$debug = false;
$truncatedDebug = false;
$ig = new \InstagramAPI\Instagram($debug, $truncatedDebug);
try {
$ig->login($username, $password);
} catch (\Exception $e) {
echo 'Something went wrong: '.$e->getMessage()."\n";
exit(0);
}
try {
$posts = [];
$comments = [];
$userId = $ig->people->getUserIdForName($username);
$maxId = null;
$response = $ig->timeline->getUserFeed($userId, $maxId);
foreach ($response->getItems() as $item) {
foreach($item->getLikers($item->getId()) as $h){
$posts[] = ['id' => $item->getId(), 'username' => $h->username];
}
foreach($ig->media->getComments($item->getId()) as $v){
if(count($v->comments) > 0){
foreach($v->comments as $c){
$comments[] = ['id' => $item->getId(), 'username' => $c->user->username, 'text' => $c->text];
}
}
}
}
print_r($posts);
print_r($comments);
} catch (\Exception $e) {
echo 'Something went wrong: '.$e->getMessage()."\n";
}
Try looping through each item of your profile then get the likes and find the username. Then if the item has a like by that user put it in an item array like so:
// Get the UserPK ID for "natgeo" (National Geographic).
$userId = $ig->people->getUserIdForName('natgeo');
// Starting at "null" means starting at the first page.
$maxId = null;
do {
$response = $ig->timeline->getUserFeed($userId, $maxId);
// In this example we're simply printing the IDs of this page's items.
foreach ($response->getItems() as $item) {
//loop through likes as u can see in [source 1][1] there is some method called 'getLikers()' which u can call on a media object.
foreach($item->getMedia()->getLikers() as $h){
// here do some if with if response user == username
}
}
source 1:https://github.com/mgp25/Instagram-API/blob/master/src/Request/Media.php
source 2:https://github.com/mgp25/Instagram-API/tree/master/examples
source 3:https://github.com/mgp25/Instagram-API/blob/e66186f14b9124cc82fe309c98f5acf2eba6104d/src/Response/MediaLikersResponse.php
By reading the source files this could work i havent tested it yet.
for new version of mgp25 this code work fine
POST UPDATED
$likes = [];
$comments = [];
$userId = $ig->people->getUserIdForName($username);
$maxId = null;
$response = $ig->timeline->getUserFeed($userId, $maxId);
$posts = $response->jsonSerialize();
foreach ($response->getItems() as $item) {
$likers = $ig->media->getLikers($item->getId());
if ($likers != null) {
foreach ($likers->getUsers() as $h) {
$likes[] = ['id' => $item->getId(), 'username' => $h->getUsername()];
}
}
$commentsList = $ig->media->getComments($item->getId());
if ($commentsList != null) {
foreach ($commentsList->getComments() as $c) {
$comments[] = ['id' => $item->getId(), 'username' => $c->getUser()->getUsername(), 'text' => $c->getText()];
}
}
}
updated reference link
i found a very good PHP solution here for compareing 2 CSV Files.
The Only Problem is the Result Page..
index.php?f1=re1.csv&f2=re2.csv
<?php
//---- init
$strFileName1=isset($_REQUEST['f1'])?$_REQUEST['f1']:'';
$strFileName2=isset($_REQUEST['f2'])?$_REQUEST['f2']:'';
if ( !$strFileName1 ) { die("I need the first file (f1)"); }
if ( !$strFileName2 ) { die("I need the second file (f2)"); }
try {
$arrFile1 = parseData($strFileName1);
$arrFile2 = parseData($strFileName2);
} catch (Exception $e) {
die($e->getMessage());
}
$rowCount1=count($arrFile1);
$rowCount2=count($arrFile2);
$colCount1=count($arrFile1[0]);
$colCount2=count($arrFile2[0]);
$highestRowCount = $rowCount1>$rowCount2 ? $rowCount1:$rowCount2;
$highestColCount = $colCount1>$colCount2 ? $colCount1:$colCount2;
$row = 0;
$err = 0;
//---- code
echo "<h2>Vergleich $strFileName1 and $strFileName2</h2>";
echo "\n<table border=1>";
echo "\n<tr><th>Err<th>Tabelle<th>Row#<th>Col#<th>Data in $strFileName1<th>Data in $strFileName2";
while($row<$highestRowCount) {
if(!isset($arrFile1[$row])) {
echo "\n<tr><td>Row missing in $strFileName1<th>$row";
$err++;
} elseif(!isset($arrFile1[$row])) {
echo "\n<tr><td>Row missing in $strFileName2<th>$row";
$err++;
} else {
$col=0;
while($col<$highestColCount) {
if ( !isset($arrFile1[$row][$col]) ) {
echo "\n<tr><td>Data missing in $strFileName1<td>$row<td>$col<td><td>".htmlentities($arrFile2[$row][$col]);
$err++;
} elseif ( !isset($arrFile2[$row][$col]) ) {
echo "\n<tr><td>Data missing in $strFileName1<td>$row<td>$col<td>".htmlentities($arrFile1[$row][$col]) ."<td>";
$err++;
} elseif ( $arrFile1[$row][$col] != $arrFile2[$row][$col] ) {
echo "\n<tr><td>Data mismatch";
echo "<td>Tabelle <td>$row <td>$col";
echo "<td>".htmlentities($arrFile1[$row][$col]);
echo "<td>".htmlentities($arrFile2[$row][$col]);
$err++;
}
$col++;
}
}
$row++;
}
echo "</table>";
if ( !$err ) {
echo "<br/>\n<br/>\nThe two csv data files seem identical<br/>\n";
} else {
echo "<br/>\n<br/>\nThere are $err differences";
}
//---- functions
function parseData($strFilename) {
$arrParsed = array();
$handle = fopen($strFilename , "r");
if ($handle) {
while (!feof($handle)) {
$data = fgetcsv($handle , 0 , ',' , '"' );
if ( empty($data)) continue; //empty row
$arrParsed[]=$data;
}
fclose($handle);
} else {
throw new Exception("File read error at $strFilename");
}
return $arrParsed;
}
?>
The Result displays the Row# and Col# of the file..
but what i need is the Name of the Col..
This is how my CSV looks like:
ISO_COUNTRY_CODE,CNT_POSTAL_CODE,ORDER1_ADMIN_TYP_1112,ORDER2_ADMIN_TYP_1113,ORDER8_ADMIN_TYP_1119,BUILTUP_ID
AND,7,0,0,7,40
ARG,1970,25,0,514,4076
AUS,2612,9,0,10978,4597
AUT,2213,9,95,2354,10304
BEL,1148,3,11,589,3781
BGR,4507,28,0,264,5375
I want to see in which "ISO_COUNTRY_CODE" is the CNT_POSTAL_CODE wrong..
$rowname = $row; // here i want to see the RAW of the Table
"like AND or ARG etc"
$colname = $col; // here i want to see the COL of the Table
"like CNT_POSTAL_CODE
or ORDER1_ADMIN_TYP_1112 etc "
could you please help me to find what cause this process to reach 500MB of memory usage.
It is basically an html page downloader.
Despite the fact that the process is stable (and do not exceed that limit), it' meant to use on low performing machine and I'm not satisfied.
The size of the mysql table 'Sites' is 170MB.
following the script code.
Thanks in advance.
function start() {
try {
global $log;
$db = getConnection();
Zend_Db_Table::setDefaultAdapter($db);
$log->logInfo("logger start");
while (1) {
$sitesTable = new Zend_Db_Table('Sites');
$rowset = $sitesTable->fetchAll();
foreach ($rowset as $row) {
if (time() >= (strtotime($row->lastUpdate) + $row->pollingHours * 60 * 60)) {
db_updateHtml($row);
}
}
}
} catch (Exception $e) {
global $log;
$log->logError($e->getMessage());
}
}
function db_updateHtml($siteRecord) {
try {
if ($siteRecord instanceof Zend_Db_Table_Row) {
$rowwithConnection = $siteRecord;
$url = $siteRecord->url;
$idSite = $siteRecord->idSite;
$crawler = new Crawler();
$sitesTable = new Zend_Db_Table('Sites');
//$rowwithConnection = $sitesTable->fetchRow(
// $sitesTable->select()->where('idSite = ?', $idSite));
$newHtml = HtmlDbEncode($crawler->get_web_page($url));
if (strlen($newHtml) < 10) {
global $log;
$log->logError("Download failed for: url: $url \t idsite: $idSite ");
}
if ($rowwithConnection->isChecked != 0) {
$rowwithConnection->oldHtml = $rowwithConnection->newHtml;
$rowwithConnection->isChecked = 0;
}
$rowwithConnection->newHtml = $crawler->get_web_page($url);
$rowwithConnection->lastUpdate = date("Y-m-d H:i:s");
//$rowwithConnection->diffHtml = getDiff($rowwithConnection->oldHtml, $rowwithConnection->newHtml, false, $rowwithConnection->minLengthChange);
$rowwithConnection->diffHtml = getDiffFromRecord($rowwithConnection, false, $rowwithConnection->minLengthChange);
/* if (strlen($rowwithConnection->diffHtml) > 30) {
$rowwithConnection->lastChanged = $rowwithConnection->lastUpdate;
} */
$rowwithConnection->save();
} else {
$log->logCrit("siteRecord is uninitialized");
}
} catch (Exception $e) {
global $log;
$log->logError($e->getMessage());
}
}
function getDiffFromRecord($row, $force = false, $minLengthChange = 100) {
if ($row instanceof Zend_Db_Table_Row) {
require_once '/var/www/diff/library/finediff.php';
include_once '/var/www/diff/library/Text/Diff.php';
$diff = new AndreaDiff();
$differences = $diff->getDiff($row->oldHtml, $row->newHtml);
if ($diff->isChanged($minLengthChange) || $force) {
$row->lastChanged = $row->lastUpdate;
$row->isChecked = false;
return ($differences);
}
}
return null;
}
function getConnection() {
try {
$pdoParams = array(
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
);
$db = new Zend_Db_Adapter_Pdo_Mysql(array(
'host' => '127.0.0.1',
'username' => 'root',
'password' => 'administrator',
'dbname' => 'diff',
'driver_options' => $pdoParams
));
return $db;
} catch (Exception $e) {
global $log;
$log->logError($e->getMessage());
}
}
1) Try use fetch method, not fetchAll:
foreach($sitesTable->fetch() as $row){
//...
}
2) try to unset all variables which store html code (if you save it in memory), at last iteration i suppose variable $rowwithConnection will have html code inside.
When i want profile php application i use xhprof it will save you a LOT of time. Good Luck!
Im trying to make Cassandra run with PHP on Windows 7 at the moment.
I installed cassandra and thrift...
When I call the cassandra-test.php, I get the following error:
( ! ) Fatal error: Call to undefined method
CassandraClient::batch_insert() in
C:\xampp\htdocs\YiiPlayground\cassandra-test.php on line 75
Call Stack
# Time Memory Function Location
1 0.0014 337552 {main}( ) ..\cassandra-test.php:0
2 0.0138 776232 CassandraDB->InsertRecord(
) ..\cassandra-test.php:304
The cassandra-test.php looks as follows:
<?php
// CassandraDB version 0.1
// Software Projects Inc
// http://www.softwareprojects.com
//
// Includes
$GLOBALS['THRIFT_ROOT'] = 'C:/xampp/htdocs/Yii/kallaspriit-Cassandra-PHP-Client-Library/thrift';
//$GLOBALS['THRIFT_ROOT'] = realpath('E:/00-REGIESTART/Programme/Cassandra/thrift');
require_once $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/Cassandra.php';
require_once $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/cassandra_types.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php';
class CassandraDB
{
// Internal variables
protected $socket;
protected $client;
protected $keyspace;
protected $transport;
protected $protocol;
protected $err_str = "";
protected $display_errors = 0;
protected $consistency = 1;
protected $parse_columns = 1;
// Functions
// Constructor - Connect to Cassandra via Thrift
function CassandraDB ($keyspace, $host = "127.0.0.1", $port = 9160)
{
// Initialize
$this->err_str = '';
try
{
// Store passed 'keyspace' in object
$this->keyspace = $keyspace;
// Make a connection to the Thrift interface to Cassandra
$this->socket = new TSocket($host, $port);
$this->transport = new TFramedTransport($this->socket, 1024, 1024);
$this->protocol = new TBinaryProtocolAccelerated($this->transport);
$this->client = new CassandraClient($this->protocol);
$this->transport->open();
}
catch (TException $tx)
{
// Error occured
$this->err_str = $tx->why;
$this->Debug($tx->why." ".$tx->getMessage());
}
}
// Insert Column into ColumnFamily
// (Equivalent to RDBMS Insert record to a table)
function InsertRecord ($table /* ColumnFamily */, $key /* ColumnFamily Key */, $record /* Columns */)
{
// Initialize
$this->err_str = '';
try
{
// Timestamp for update
$timestamp = time();
// Build batch mutation
$cfmap = array();
$cfmap[$table] = $this->array_to_supercolumns_or_columns($record, $timestamp);
// Insert
$this->client->batch_insert($this->keyspace, $key, $cfmap, $this->consistency);
// If we're up to here, all is well
$result = 1;
}
catch (TException $tx)
{
// Error occured
$result = 0;
$this->err_str = $tx->why;
$this->Debug($tx->why." ".$tx->getMessage());
}
// Return result
return $result;
}
// Insert SuperColumn into SuperColumnFamily
// (Equivalent to RDMBS Insert record to a "nested table")
function InsertRecordArray ($table /* SuperColumnFamily */, $key_parent /* Super CF */,
$record /* Columns */)
{
// Initialize
$err_str = '';
try
{
// Timestamp for update
$timestamp = time();
// Build batch mutation
$cfmap = array();
$cfmap[$table] = $this->array_to_supercolumns_or_columns($record, $timestamp);
// Insert
$this->client->batch_insert($this->keyspace, $key_parent, $cfmap, $this->consistency);
// If we're up to here, all is well
$result = 1;
}
catch (TException $tx)
{
// Error occured
$result = 0;
$this->err_str = $tx->why;
$this->Debug($tx->why." ".$tx->getMessage());
}
// Return result
return $result;
}
// Get record by key
function GetRecordByKey ($table /* ColumnFamily or SuperColumnFamily */, $key, $start_from="", $end_at="")
{
// Initialize
$err_str = '';
try
{
return $this->get($table, $key, NULL, $start_from, $end_at);
}
catch (TException $tx)
{
// Error occured
$this->err_str = $tx->why;
$this->Debug($tx->why." ".$tx->getMessage());
return array();
}
}
// Print debug message
function Debug ($str)
{
// If verbose is off, we're done
if (!$this->display_errors) return;
// Print
echo date("Y-m-d h:i:s")." CassandraDB ERROR: $str\r\n";
}
// Turn verbose debug on/off (Default is off)
function SetDisplayErrors($flag)
{
$this->display_errors = $flag;
}
// Set Consistency level (Default is 1)
function SetConsistency ($consistency)
{
$this->consistency = $consistency;
}
// Build cf array
function array_to_supercolumns_or_columns($array, $timestamp=null)
{
if(empty($timestamp)) $timestamp = time();
$ret = null;
foreach($array as $name => $value) {
$c_or_sc = new cassandra_ColumnOrSuperColumn();
if(is_array($value)) {
$c_or_sc->super_column = new cassandra_SuperColumn();
$c_or_sc->super_column->name = $this->unparse_column_name($name, true);
$c_or_sc->super_column->columns = $this->array_to_columns($value, $timestamp);
$c_or_sc->super_column->timestamp = $timestamp;
}
else
{
$c_or_sc = new cassandra_ColumnOrSuperColumn();
$c_or_sc->column = new cassandra_Column();
$c_or_sc->column->name = $this->unparse_column_name($name, true);
$c_or_sc->column->value = $value;
$c_or_sc->column->timestamp = $timestamp;
}
$ret[] = $c_or_sc;
}
return $ret;
}
// Parse column names for Cassandra
function parse_column_name($column_name, $is_column=true)
{
if(!$column_name) return NULL;
return $column_name;
}
// Unparse column names for Cassandra
function unparse_column_name($column_name, $is_column=true)
{
if(!$column_name) return NULL;
return $column_name;
}
// Convert supercolumns or columns into an array
function supercolumns_or_columns_to_array($array)
{
$ret = null;
for ($i=0; $i<count($array); $i++)
foreach ($array[$i] as $object)
{
if ($object)
{
// If supercolumn
if (isset($object->columns))
{
$record = array();
for ($j=0; $j<count($object->columns); $j++)
{
$column = $object->columns[$j];
$record[$column->name] = $column->value;
}
$ret[$object->name] = $record;
}
// (Otherwise - not supercolumn)
else
{
$ret[$object->name] = $object->value;
}
}
}
return $ret;
}
// Get record from Cassandra
function get($table, $key, $super_column=NULL, $slice_start="", $slice_finish="")
{
try
{
$column_parent = new cassandra_ColumnParent();
$column_parent->column_family = $table;
$column_parent->super_column = $this->unparse_column_name($super_column, false);
$slice_range = new cassandra_SliceRange();
$slice_range->start = $slice_start;
$slice_range->finish = $slice_finish;
$predicate = new cassandra_SlicePredicate();
$predicate->slice_range = $slice_range;
$resp = $this->client->get_slice($this->keyspace, $key, $column_parent, $predicate, $this->consistency);
return $this->supercolumns_or_columns_to_array($resp);
}
catch (TException $tx)
{
$this->Debug($tx->why." ".$tx->getMessage());
return array();
}
}
// Convert array to columns
function array_to_columns($array, $timestamp=null) {
if(empty($timestamp)) $timestamp = time();
$ret = null;
foreach($array as $name => $value) {
$column = new cassandra_Column();
$column->name = $this->unparse_column_name($name, false);
$column->value = $value;
$column->timestamp = $timestamp;
$ret[] = $column;
}
return $ret;
}
// Get error string
function ErrorStr()
{
return $this->err_str;
}
}
// Initialize Cassandra
$cassandra = new CassandraDB("SPI");
// Debug on
$cassandra->SetDisplayErrors(true);
// Insert record ("Columns" in Cassandra)
$record = array();
$record["name"] = "Mike Peters";
$record["email"] = "mike at softwareprojects.com";
if ($cassandra->InsertRecord('mytable', "Mike Peters", $record)) {
echo "Record (Columns) inserted successfully.\r\n";
}
// Print record
$record = $cassandra->GetRecordByKey('mytable', "Mike Peters");
print_r($record);
?>
Any ideas on this, how to fix this?
Thanks a lot!
You really don't want to do Thrift by hand if you can avoid it. Take a look at phpcassa library:
https://github.com/thobbs/phpcassa
Oh, and in the above, looks like you want 'batch_mutate' not 'batch_insert' on ln. 75. That method changed names in versions of cassandra > 0.6.x