0

I set code to hit the links to the proxy list in php. The hit is generated succesfully. and I am getting the output in html. but this html is not in display proper on browswer. I want exact html in return from the proxy. any body know how to do it please give me some idea about it here is the code which I am using

<?php
$curl = curl_init();
$timeout = 30;
$proxies = file("proxy.txt");
$r="https://www.abcdefgth.com";
// Not more than 2 at a time
for($x=0;$x<2000; $x++){
//setting time limit to zero will ensure the script doesn't get timed out
set_time_limit(30);

//now we will separate proxy address from the port
//$PROXY_URL=$proxies[$getrand[$x]];
echo $proxies[$x];
curl_setopt($curl, CURLOPT_URL,$r);
curl_setopt($curl , CURLOPT_PROXY ,  preg_replace('/\s+/', '',$proxies[$x]));
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5");
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_REFERER, "http://google.com/");
$text = curl_exec($curl);

echo "Hit Generated:";


}

?>
2
  • We don't know what format is proper. So, no, noone has no idea. Commented Aug 12, 2017 at 8:03
  • right after <?php , add header("content-type: text/plain;charset=utf8"); - does it display correctly then? Commented Aug 12, 2017 at 13:56

1 Answer 1

1

A simple look into the documentation of the function you use would have answered your question:

On http://php.net/manual/en/function.curl-exec.php it clearly states right in the "Return value" section that you receive back either a boolean value from that function. Except if you have specified the CURLOPT_RETURNTRANSFER flag which you did not do you in code.

So have a try adding

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

Followed by any attempt to actually output the result you receive in $text, which you also forgot.

Sign up to request clarification or add additional context in comments.

2 Comments

its all mess up I want nice html here in return
@azadchouhan Looks like "nice html" to me. I assume you refer to missing style rules. But those are not part of the html, you have to add them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.