Re: [SMARTY] file problems

From: Date: Thu, 19 Jun 2003 12:27:05 +0000
Subject: Re: [SMARTY] file problems
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9731@lists.php.net to get a copy of this message
I guess this is because Google rejects requests from PHP... the only thing you can do is to execute the HTTP request manually and fake the User Agent Header (PHP sends something like... uh... dunno, but must be something with "PHP" in it :D), use something like Mozilla/5.0 (compatible; Konqueror/3; Linux) oh... and just for your information... you are on the very wrong mailing list. this list is for Smarty Template engine (http://smarty.php.net/) David ----- Original Message ----- From: "Adina" <adina@eteric-ro.net> To: <smarty-general@lists.php.net> Sent: Thursday, June 19, 2003 3:10 PM Subject: [SMARTY] file problems 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&st art=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&st art=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 (#9731) next »