fsockopen question
Posted: Wed Feb 07, 2007 5:08 pm
I am running a dedicated server where a client is using a script called PHProxy.
Basically, PHProxy allows visitors to type in a domain, the web page is retrieved by my server, and then sent back to the visitor. This script uses fsockopen to retrieve the webpage/file.
Imagine this for a moment...
I use the script to download a 10MB file. The server retrieves this file (10MB Incoming Bandwidth) and then the server sends the files to me (10MB Outgoing Bandwidth).
In total, the proxy script consumes 20MB of bandwidth to serve the 10MB file.
Anyhow, apache is not good at tracking the total bandwidth used... only the bytes returned from the header response are counted.
This allows the client to exceed his bandwidth limit because it's not being tracked.
So I thought I would get smart about it.... I put the client on a dedicated IP and was tracking the bandwidth used by that IP. After a day or so, it was obvious that incoming bandwidth was still not being tracked. Outgoing bandwidth is being tracked fine.
What I found, was that even though the client is on a dedicated IP, fsockopen is still connecting from the servers main IP. So all incoming bandwidth (the Proxy Script retrieving the pages/files) can still not be accurately counted. I verified this by visiting one of those "What is my IP Address sites" through his proxy script.
Server runs php 5.2.0 in cgi mode...so everyone can use their own php.ini. Is there a php.ini setting, or something I can add to the fsockopen connection string, that will make it use the clients dedicated IP rather than the servers main IP?
Basically, PHProxy allows visitors to type in a domain, the web page is retrieved by my server, and then sent back to the visitor. This script uses fsockopen to retrieve the webpage/file.
Imagine this for a moment...
I use the script to download a 10MB file. The server retrieves this file (10MB Incoming Bandwidth) and then the server sends the files to me (10MB Outgoing Bandwidth).
In total, the proxy script consumes 20MB of bandwidth to serve the 10MB file.
Anyhow, apache is not good at tracking the total bandwidth used... only the bytes returned from the header response are counted.
This allows the client to exceed his bandwidth limit because it's not being tracked.
So I thought I would get smart about it.... I put the client on a dedicated IP and was tracking the bandwidth used by that IP. After a day or so, it was obvious that incoming bandwidth was still not being tracked. Outgoing bandwidth is being tracked fine.
What I found, was that even though the client is on a dedicated IP, fsockopen is still connecting from the servers main IP. So all incoming bandwidth (the Proxy Script retrieving the pages/files) can still not be accurately counted. I verified this by visiting one of those "What is my IP Address sites" through his proxy script.
Server runs php 5.2.0 in cgi mode...so everyone can use their own php.ini. Is there a php.ini setting, or something I can add to the fsockopen connection string, that will make it use the clients dedicated IP rather than the servers main IP?