Parse Variables to php and run php script

Come up with a useful post-processing script? Share it here!
Post Reply
Mikie
Newbie
Newbie
Posts: 10
Joined: October 21st, 2011, 10:46 am

Parse Variables to php and run php script

Post by Mikie »

Is it possible to have sabnzbd+ run a post processing script that parses variables to a php script and runs it? Preferable under windows as well as linux. The reason I ask is I have a fully working php script that does everything I want and I would like to make sabnzbd execute it. Any assistance would be great.

Thanks
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: Parse Variables to php and run php script

Post by sander »

Do you mean on the server side or on the client of PHP?
And do you mean the variable from the download job?

Server side: yes, a (SAB) script can write anything, so also a PHP source page.
Client side: can you parse the variables into an URL to that PHP page as input? So, is it a GET, and not a POST?
Mikie
Newbie
Newbie
Posts: 10
Joined: October 21st, 2011, 10:46 am

Re: Parse Variables to php and run php script

Post by Mikie »

Server side will do. How would I do this?
Client side would work as I can do that but its more work so server side it will be
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: Parse Variables to php and run php script

Post by sander »

So you want a script to converts the name of the downloaded file into a PHP source file?

Can you give the PHP format source page, and point where you want the SAB-download variables? See http://wiki.sabnzbd.org/user-scripts for the variables that are available.
Mikie
Newbie
Newbie
Posts: 10
Joined: October 21st, 2011, 10:46 am

Re: Parse Variables to php and run php script

Post by Mikie »

Not exactly I just want all the information sabnzbd can give me but in a way that php can read it and then for the post processing script the execute the php script. This is what I have. A php file that uploads stuff I download. However for it to be automated I need to know some stuff about each file so I want a post processing script that collects all the information about the nzb (1 - 7) and then hands it over to php in the form of 7 variable and runs the php file. In the php file I will set up the variables so they are the same as the ones the post processing script gives me.

Sorry if this is very confusing..
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: Parse Variables to php and run php script

Post by sander »

Mikie wrote:Not exactly I just want all the information sabnzbd can give me but in a way that php can read it and then for the post processing script the execute the php script. This is what I have. A php file that uploads stuff I download. However for it to be automated I need to know some stuff about each file so I want a post processing script that collects all the information about the nzb (1 - 7) and then hands it over to php in the form of 7 variable and runs the php file. In the php file I will set up the variables so they are the same as the ones the post processing script gives me.

Sorry if this is very confusing..
I still don't understand what you want, and whether you want it on the PHP server side or on the client side. Sorry.
Mikie
Newbie
Newbie
Posts: 10
Joined: October 21st, 2011, 10:46 am

Re: Parse Variables to php and run php script

Post by Mikie »

When a download finished I need complete.php to be run automatically

In complete.php I have variables

$name
$directory
$status
$category

which need to be populated from the information that sabnzbd has.

Can this be done via any method. As long as complete.php is run and the variables are made available I am happy.
User avatar
jcfp
Release Testers
Release Testers
Posts: 1004
Joined: February 7th, 2008, 12:45 pm

Re: Parse Variables to php and run php script

Post by jcfp »

So what's the problem? On Linux, you can probably just run a php script directly, by pointing the shebang line to a command line php executable, etc, etc:

Code: Select all

#!/usr/bin/php

<? phpinfo() ?>
Might have to use an intermediate 'regular' shell script to start php if your operating system doesn't support this. Sab passes a number of arguments to every postprocessing script, just use them (or pass them along in the intermediate script) as desired. Every scripting language can deal with command line arguments, php is no exception.
Mikie
Newbie
Newbie
Posts: 10
Joined: October 21st, 2011, 10:46 am

Re: Parse Variables to php and run php script

Post by Mikie »

I would like it to run on windows and need a step by step guide on how to do it
Post Reply