note 19500 modified in function.curl-setopt by danbrown

From: Date: Sun, 17 May 2009 17:37:27 +0000
Subject: note 19500 modified in function.curl-setopt by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155007@lists.php.net to get a copy of this message
It's possible to take advantage of multiple URLs on the same host in one curl_exec transaction ... just use multiple instances of CURLOPT_URL. Example: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://example.com/a.html"); curl_setopt($ch, CURLOPT_URL, "http://example.com/b.html"); curl_setopt($ch, CURLOPT_URL, "http://example.com/c.html"); curl_exec($ch); curl_close($ch); ?> ... the URLs appear to be hit in the same order they are entered. This takes advantage of cURL's Persistant Connection capability if all the URLs are on the same host! --was-- It's possible to take advantage of multiple URLs on the same host in one curl_exec transaction ... just use multiple instances of CURLOPT_URL. Example: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://foo.com/a.html"); curl_setopt($ch, CURLOPT_URL, "http://foo.com/b.html"); curl_setopt($ch, CURLOPT_URL, "http://foo.com/c.html"); curl_exec($ch); curl_close($ch); ... the URLs appear to be hit in the same order they are entered. This takes advantage of cURL's Persistant Connection capability if all the URLs are on the same host! http://php.net/manual/en/function.curl-setopt.php

« previous php.notes (#155007) next »