So I want to pass my scraped items to a php script, I have in my pipeline:
class TalkPhpPipeline(object):
def process_item(self, item, spider):
toPHP = json.dumps(dict(item))
os.system( '/usr/bin/php script.php %s' % toPHP)
return item
and in my script.php
<? require_once('wp-config.php');
$string = $argv[1];
echo 'PHP see this ';
var_dump($string);
The spider talks to script.php just fine, however my script.php only sees a srting of lenght 7 like this {title:
, if I instead replace toPHP with item['title']
, then the php side sees [usomewhere only we know]
, what I really want to pass to php is a string like:
{'title': [u'somewhere only we know']}
or just {'title': ['somewhere only we know']}
, of course with all other fields that my item contains, how do I do that?
Thanks,