Re: curl grabbing a website

From: Date: Tue, 21 Sep 2004 00:59:47 +0000
Subject: Re: curl grabbing a website
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-197370@lists.php.net to get a copy of this message
* Martin Justra <martinj@despammed.com>: > I finally managed to grab the website via curl. Now the problen is that I > want to have a small piece of that site. I tried to cut that site by > explode. Now the browser hangs. He says "waiting for www.domain.de".... and > does nothing. > > Here is my listing: > <?php > $ch = curl_init(); > curl_setopt($ch, CURLOPT_URL, > "¡í‚¬þÛ > ]¥kÖ Ôú”Ëhttps://www.example?benutzer=aaa&passwort=bbb&ic=tracking"); > curl_setopt($ch, CURLOPT_HEADER, 0); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); > $test = curl_exec($ch); > $teil = explode("<!-- rows -->", $test); > echo $teil[0]; > curl_close($ch); Couple of things: 1) I'd close the curl connection before doing your explode 2) I'd check for an error returned by the curl_exec() -- you may have an error and not even realize it. -- Matthew Weier O'Phinney | mailto:matthew@garden.org Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org

« previous php.general (#197370) next »