[eluser]CroNiX[/eluser]
if you look at the docs for the loader, you will see that the 2nd parameter is for naming that instance of the library to something else.
$this->load->library('some_library', 'call_it_this');
To access some_library now, you do
$this->call_it_this->method.
This allows you to have multiple instances of the same object.
$this->load->library('some_library', 'call_it_this');
$this->load->library('some_library', 'call_it_that');
produces 2 separate instances of some_library which are now accessed like:
$this->call_it_this->method
$this->call_it_that->method
What you need to do is make a $url variable in your remoteconnector library, and create a setter method to set it.
Code:
private $url = '';
function set_url($url)
{
$this->url = $url;
}
then in your
__to_string method add:
$url = $this->url;
and use that parameter to get it.
Then in your loop...
Code:
$this->load->library('RemoteConnector'); //no second parameter, only load library once (outside of loop)
foreach($this->address as $showLocation){
//now geocode each showLocation
$address = urlencode($showLocation);
$url = array("url"=>"http://tinygeocoder.com/create-api.php?q=$address");
$this->remoteconnector->set_url($url); //set the url in the library
$coord = $this->remoteconnector->__toString(); //get the string contents of the remote file
echo $showLocation." | ".$coord."\n";
}
I hope that makes sense.