file problems

From: Date: Thu, 19 Jun 2003 13:10:17 +0000
Subject: file problems
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9730@lists.php.net to get a copy of this message
Hello! I have this script named test.php: <?php // Get a file into an array. In this example we'll go through HTTP to get // the HTML source of a URL. $lines = file('http://www.google.fr/search?q=beautiful&hl=fr&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=N'); // Loop through our array, show html source as html source; and line numbers too. foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n"; } ?> This script dosen't work. I receive the following warning: Warning: file("http://www.google.fr/search?q=beautiful&hl=fr&lr=&ie=UTF-8&oe=UTF-8&start=10&sa=N") - No such file or directory in test.php on line 4 With this script I want to get the HTML source of a search result on google. I tried with another search engines and it works, only with google dosen't work. For examle I have the script: <?php // Get a file into an array. In this example we'll go through HTTP to get // the HTML source of a URL. $lines = file('http://search.yahoo.com/search?p=sexe&ei=UTF-8&b=1'); // Loop through our array, show html source as html source; and line numbers too. foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n"; } ?> and I have no problem with it. I thought there is a problem with google search engine but if I put the link in browser it works. Can you help me? Maybe you have a suggestion what shall I do to make it work? Thanks for your support! Adina

« previous php.smarty.general (#9730) next »