hello all,
i m trying to scrape a web
i use this code
<?php
$line_array = array('308215','304391','308080','425716','418536');
foreach($line_array as $line){
$html = file_get_contents('http://www.example.com/xxx-'.$line);
//echo $html;
file_put_contents('xmple_com_'.$line.'.html', $html);
echo "\nLink Saved: $line";
?>
and it works
then i' to put all number in the array into a list.txt
then i open the the file
the code like this
<?php
$fd = fopen("list.txt", "r");
while (!feof ($fd))
{
$buffer = fgets($fd, 4096);
$lines[] = $buffer;
}
foreach($line_array as $line){
$html = file_get_contents('http://www.example.com/xxx-'.$line);
//echo $html;
file_put_contents('xmple_com_'.$line.'.html', $html);
echo "\nLink Saved: $line";
}
?>
the result is warning errors
Warning: file_put_contents(xmple_com_
.html): failed to open stream: Invalid argument in C:\xampp\htdocs\test\detail_links\test\test.php on line 15
Link Saved:
Warning: file_get_contents(http://www.example.com/xxx-): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
in C:\xampp\htdocs\simon\detail_links\tets\test.php on line 11
Link Saved:
that's the result
any can help me for the solution
thank you