Issue PHP script with SQUID PROXY

xinyi85

New Member
Joined
Nov 24, 2020
Messages
3
Reaction score
0
Credits
48
Hi everyone,

I need to create a PHP script so my SQUID Proxy in Linux can replace a text inside <div> tag for another one.

In squid proxy I am using "url_rewrite_program /path/to/myscript" inside "/etc/squid/squid.config"

my script looks like this as is quite simple:

-----------------------------

!#/usr/bin/php

<?php
str_replace("NEW_TITLE","OLD_TITLE",'<div class="myDiv"><h3>OLD_TITLE</h3></div>');
?>

--------------------------

The idea is that when i place the script in url_rewrite_program in squid.config when I check the website that contains <div class="myDiv"><h3>OLD_TITLE</h3></div> I will replace OLD_TITLE for NEW_TITLE on the fly.

The result doesn't work so when I try to check the website the browser shows an _error_ with the proxy. The proxy is working fine before adding the script in url_rewrite_program.

Any idea what I should do here?

Thanks!
 

Members online


Latest posts

Top