troubleshooting Question

php curl script

Avatar of djroh
djroh asked on
7 Comments1 Solution385 ViewsLast Modified:
I'm using a script to edit the referrer which works but somehow the client ip is not being preserved and the server ip where the php code is hosted become seen as the client ip.  Am I missing something?  

$url_page = "";
$user_agent = "Mozilla/4.0";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url_page);
curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
curl_setopt ($ch, CURLOPT_REFERER, '');

$string = curl_exec($ch);
header("Content-type: ".curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
echo $string;

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros