web services - Communication between PHP and Perl CGI scripts -
i have 2 scripts carry out different tasks on server. 1 written in perl (.cgi) other in php.
i trying send out request perl cgi script doing this:
$ua = lwp::useragent->new; $ua->agent("$0/0.1 " . $ua->agent); $ua->timeout(30); $querystr = (xxxmaskedxxx); $request = http::request->new('get', $querystr); $response = $ua->request($request); if ($response->is_success) { $search = strpos($res->content, "not"); if($search==true) { return -1; } }
i tried 2 ways send result php:
this:
httpresponse::setcache(true); httpresponse::setcontenttype('text/html'); if (!$result) httpresponse::setdata("<html>message not delivered</html>"); else httpresponse::setdata("<html>message delivered</html>"); httpresponse::send();
and this:
echo "content-type: text/html\n\n"; if (!$result) echo 'message not delivered' . php_eol; else echo 'message delivered' . php_eol;
but $response->is_success
returns false both case? when try print response out, getting this:
response http::response=hash(0x97a8b34)
what have done wrong?
also 2 scripts sitting side side. there better ways communicate between them?
perl calling cli.php
script command line arguments,
#!/usr/bin/perl $content = `/usr/bin/php cli.php xxxmaskedxxx`; print $content;
cli.php
echoing received argument
<?php // output first argument command line print $argv[1];
Comments
Post a Comment