0

I'm relatively new to Joomla & PHP and I'm experimenting with ways of making Joomla talk to external applications. I'm trying to start outside of Joomla ( simple script, 'call.php', calling PHP script 'interface.php' & capturing the output).

When that's working I want to integrate it into Joomla (so my custom component or module can call interface.php and capture it's output).

So far interface.php works on the command line (outputs increment of the value passed & also appends to a log file), but not when called by (call.php). What happens is 'interface.php' just runs as if a variable had never been passed to it :-(.

Can anyone say what needs to added & give any tips for making this work with a Joomla module or MVC component.

DETAILS:

  • I'm using XAMPP for Windows 7

  • SCRIPT#1: call.php

SCRIPT#2: interface.php

<?php
/* This script forms the basis of a test interface between Joomla and an external data source. It will:
1) return the increment of the value it was passed and 
2) append to a flat file: 
a) a time stamp of when it was called, 
b) the value of the given parameter and 
c) the incremented value that was returned  
*/
$p1 = $_SERVER['argv'][1];
$p2 = $p1 + 1;

// Open file file for writing (append mode)
// Append to file timestamp + p1 (parameter) + p2 (p1+1)
$fh = fopen("log.txt",'a+');
$entry = "\n" . date("l,j F Y; G.i.s:", time()) . " => [p = $p1]" . " AND [p + 1 = $p2]";
fwrite($fh, $entry) or die("Could not write to file");
fclose($fh);

// Return increment of value input ($p2)
echo $p2;
?>

1 Answers1

0

When you call from the command line you use $_SERVER['argv'] when you call it via a browser $_SERVER['argv'] won't be set you need to use the $_GET or $_REQUEST.

How are you calling the interface.php script?

Vince
  • 21
  • 5