how to convert a shell script to a php script for displaying next word after pattern match

I have a shell script which I made with the help of this forum

#!/bin/sh
RuleNum=$1

cat bw_rules | sed 's/^.*-x //' | awk -v var=$RuleNum '$1==var {for(i=1;i<=NF;i++) {if($i=="-bwout") print $(i+3),$(i+1)}}'

Basically I have a pages after pages of bandwidth rules and the script gives output of a single rule number. The lines are like below:-

/usr/bwmgr/utils/bwmgr em1 -x 735 -name user92 -addr 10.10.201.92 -addrmsk 255.255.255.252 -bwout 1024000 -bwin 2048000 -statsdevice user92 -stats

When I run the script against the rules file for rule number 735, the o/p will be like below:-

sh script.sh 735

2048000 1024000

I need to display this in a web page. My web programmer tells me that I must have a php script. How can I convert this script to a php script which would give me the same results.

tia