[San-Diego-pm] Using a PHP script as a function

Christopher Hart christopher.p.hart at gmail.com
Mon Aug 9 21:53:21 PDT 2010


hi,

make sure "../dev/plant_editor/getPlantList.php" has a php shebang
#!/usr/bin/env php or whatever.. so it can run from CLI
also, take out the url-encoded get parameters since perl wont be calling it
in a browser.

You may actually need to grab those vars from $argv or w/e the PHP mechanism
for cmd line args is.. as opposed to $_POST or $_GET.

:) Good Luck!

On Mon, Aug 9, 2010 at 9:47 PM, Joel Fentin <joel at fentin.com> wrote:

> I have a perl program and I am trying to use a PHP script as a function.
> That is to say that my perl program passes data to it and it returns data. I
> have not been able to get it to run, let alone return data.
>
> If you take:
>
> http://calscape.com/dev/plant_editor/getPlantList.php?address=14295+recuerdo&city=del+mar&state=ca&zipcode=92014&native_status=native
> and put it in Firefox, it returns data which is displayed.
>
> First I tried 20 variations of:
> my $cmd = 'php
> ../dev/plant_editor/getPlantList.php?address=14295%20recuerdo&city=del%20mar&state=ca&zipcode=92014&native_status=native';
> my $Stuff = `$cmd`;
> die "|$Stuff|";
>
> It not only doesn't return data, but it doesn't seem to run the PHP.
>
> ======================
>
> I also tried:
> my $xxx = system('
> http://calscape.com/dev/plant_editor/getPlantList.php?address=14295+recuerdo&city=del+mar&state=ca&zipcode=92014&native_status=native'
> );
> die "|$xxx|";
>
> just to see if I could get it to run. I could not.
>
> ======================
>
> I also tried:
> print "Content-type: text/html\n\n";
> open(XXX,"
> http://calscape.com/dev/plant_editor/getPlantList.php?address=14295+recuerdo&city=del+mar&state=ca&zipcode=92014&native_status=native|");
> while(<XXX>){print}
> close(XXX);
>
> ======================
>
> I've run out of ideas and nothing I Googled seemed to help.
> Suggestions please.
>
>
>
> --
> Joel Fentin       tel: 760-749-8863
> Biz Website:      http://fentin.com
> Personal Website: http://fentin.com/me
> _______________________________________________
> San-Diego-pm mailing list
> San-Diego-pm at pm.org
> http://mail.pm.org/mailman/listinfo/san-diego-pm
>



-- 
Respectfully,
Chris Hart
Developer / System Administrator
Insuremonkey.com
2080 E. Flamingo, Suite 223
Las Vegas, NV 89119
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/san-diego-pm/attachments/20100809/8d945025/attachment.html>


More information about the San-Diego-pm mailing list