Answer the question
In order to leave comments, you need to log in
When reading from a file, adds a space to php. How to fix?
Hey! Here I read a list of urls from the file and send curl requests to them (this is how it should work according to the idea) But in the end it doesn’t work. I started debugging the code in 20 lines ::blink.gif:: ::-ohmy.gif::
The error was that when reading where the line break automatically adds a space...
<?php
ini_set('display_errors', 1);
echo '<meta charset="utf-8">';
$f = fopen("bot.txt", "r");
while(!feof($f))
{
$bot_url= fgets($f);
if( $curl = curl_init() ) {
curl_setopt($curl, CURLOPT_URL, 'http://'.$bot_url.'');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
$useragent="bot/0.9";
curl_setopt($curl, CURLOPT_USERAGENT, $useragent);
curl_setopt($curl,CURLOPT_REFERER, "HTTP://bot/0.9");
$out = curl_exec($curl);
echo $out;
curl_close($curl);
}
}
fclose($f);
?>
gogle.com
yandex.ru
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question