Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.


Please help...I am lost. I installed IPMAP 0.2 and signed up for Google API put my API # in the default file and am getting the following error message: Warning: fopen(): URL file-access is disabled in the server configuration in /home/content/j/s/a/jsanders1974/html/vanillaforum/extensions/IPMap/default.php on line 31 Warning: fopen( failed to open stream: no suitable wrapper could be found in /home/content/j/s/a/jsanders1974/html/vanillaforum/extensions/IPMap/default.php on line 31 Warning: fread(): supplied argument is not a valid stream resource in /home/content/j/s/a/jsanders1974/html/vanillaforum/extensions/IPMap/default.php on line 34 Any suggestions??? Thank you in advance


  • Options
    Looks like your host is preventing from fopen browsing an URL. There may be a workaround you can use but I aint gonna look into it right now...
  • Options
    No problem, have a happy holiday and any help is much appreciated when you get some time. I have it disabled for now. My e-mail is
  • Options
    Still looking for any help withg this please...
  • Options
    ::scratches head::

    You might be able to accomplish this by plugging in a function that duplicates fopen's functionality with sockets...

    ::searches Google: fopen replacment::

    Give this a shot.

    Grab that fetchURL function and paste it at the bottom of the extension, before the ?>, then replace the fopen with fetchURL on line 31.
  • Options
    Thanks I'll give it a shot.
  • Options
    I had the same fopen problem at my provider. Thank you, WallPhone for the trick. I fixed the problem. Here the fixed Code of default.php to work with fetchURL: <?php /* Extension Name: IP Map Extension Url: Description: Will display a map showing the location of the user, based on their IP address, on the user page. Version: 0.2 Author: Jon Burrows / Fantawttw Author Url: */ $Context->Dictionary["IPMap"] = "Letzter Standort"; // Change this to your Google Map API string. $Configuration['GoogleMapAPI'] = 'ABQIAAAAgglGtMeU9GS-kincxY78ihTyZnDRz4ifisjkH05N5NCcPcORuhRjxpc3FlWWe2uvg-1BTTv8_vuEew'; if ($Context->SelfUrl == "account.php") { if (!@$UserManager) $UserManager = $Context->ObjectFactory->NewContextObject($Context, "UserManager"); $AccountUserID = ForceIncomingInt("u", $Context->Session->UserID); $AccountUser = $UserManager->GetUserById($AccountUserID); $IPAddress = $AccountUser->RemoteIp; // echo $IPAddress; if ($IPAddress != '') { //$IPAddress = ''; //Used for testing. // Now code the GEOcoding for the ip address. $URL = ""; $URL .= $IPAddress; $URL .= "&position=true"; // $file = fopen("$URL","r"); // wird ersetzt durch: $r = fetchURL($URL); /* $r=""; do { $data = fread($file, 8192); $r .= $data; } while(strlen($data) !=0); */ $Latitude=''; $Latitude = substr($r,strpos($r,"Latitude:",0)+10); $Latitude = substr($Latitude,0,strpos($Latitude,"Long",0)-1); $Longitude=''; $Longitude = substr($r,strpos($r,"Longitude:")+10); // Get and display the map!! // First add the Javascript into the header. if ($Latitude !=''){ $Head->AddScript('extensions/IPMap/googlecode.js'); $GoogleString = ''; $GoogleString .= $Configuration['GoogleMapAPI']; $Head->AddString('<script type="text/javascript" src="'.$GoogleString.'"></script>'); // Now kick off the map display $addJavaScript = "<script type=\"text/javascript\"> setTimeout(\"GoogleCodeload($Latitude,$Longitude);\",1000); </script>"; $addJavaScript = $Head->AddString($addJavaScript); } } class IPMap extends Control { var $History; // The history data for the specified user function IPMap(&$Context, &$UserManager, $UserID) { $this->PostBackAction = ForceIncomingString("PostBackAction", ""); $this->Name = "IPMap"; $this->Control($Context); if ($this->PostBackAction == "") $this->History = $UserManager->GetUserRoleHistoryByUserId($UserID); } function Render() { $this->CallDelegate("PreRender"); if ($this->Context->WarningCollector->Count() == 0 && $this->PostBackAction == "" && $this->Context->Database->RowCount($this->History) > 0) { echo '<h2>'.$this->Context->GetDefinition("IPMap").'</h2>'; echo '<div id="map" style="width: 200px; height: 200px; margin:10px;"></div>'; } $this->CallDelegate("PostRender"); } } // Don't reload objects if you don't need to (ie. If another extension has already loaded it) if (!@$UserManager) $UserManager = $Context->ObjectFactory->NewContextObject($Context, "UserManager"); $AccountUserID = ForceIncomingInt("u", $Context->Session->UserID); // if ($AccountUserID == '') {$AccountUserID= if (!@$AccountUser) $AccountUser = $UserManager->GetUserById($AccountUserID); $Page->AddRenderControl($Context->ObjectFactory->NewContextObject($Context, "IPMap", $UserManager, $AccountUserID), $Configuration["CONTROL_POSITION_BODY_ITEM"]); } // manuell added function fetchURL( $url ) { $url_parsed = parse_url($url); $host = $url_parsed["host"]; /* $port = $url_parsed["port"]; if ($port==0) $port = 80; */ $port = 80; $path = $url_parsed["path"]; //if url is without final "/" if (empty($path)) $path="/"; if ($url_parsed["query"] != "") $path .= "?".$url_parsed["query"]; $out = "GET $path HTTP/1.0\r\nHost: $host\r\n\r\n"; $fp = fsockopen($host, $port, $errno, $errstr, 5); if (!$fp) { return false; } else { fwrite($fp, $out); $body = false; $in = ""; while (!feof($fp)) { $s = fgets($fp, 1024); if ( $body ) $in .= $s; if ( $s == "\r\n" ) $body = true; } } fclose($fp); return $in; } ?>
This discussion has been closed.