MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.
WebPagetest Forums - Using REST API to run server based script file

WebPagetest Forums

Full Version: Using REST API to run server based script file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am wondering if the REST API can be used to load and run a script file hosted on the private instance?

I would like to be able to submit a request from an application of our and passing the script via a post is less than ideal (login info would need to be passed).

Thanks
No, it can't pull pre-defined scripts (currently anyway).
(08-30-2014 01:48 AM)pmeenan Wrote: [ -> ]No, it can't pull pre-defined scripts (currently anyway).

Thanks, good to know. Maybe if I have time I'll search the code see what is involved in do that (maybe hardcode path and just send filename to minimize security risk)
Shouldn't be too hard. Somewhere around here: https://github.com/WPO-Foundation/webpag...st.php#L76

Add a new parameter that identifies pre-defined scripts (say "runscript") and if that parameter is set go load the script into $test['script']. It will get treated as if it was passed in from that point on (do it after $test['script'] is initially set or it will be overwritten). You need to be a bit careful about server attacks so don't pass in the actual file name unless you do some regex scrubbing.

Another option (maybe cleaner) would be to define script replacement strings and in ValidateScript ( https://github.com/WPO-Foundation/webpag....php#L1105 ) you could do the string replacement like we do for the built-in %URL% and %HOST% placeholders.
Ahh cool. Thanks for the info, the cleaner is a good idea.
Reference URL's