curl-users
Curl basics
Date: Wed, 12 Mar 2008 05:53:27 +0000
Im trying to get curl to activate some ajax stuff. How do I go about that.
Cheers
Andrew
I need to work out how to operate these controls
-------------------------------------------------------------------------------------------
<div class="buildingLevel"><span class="textLabel">Level </span>1</div>
<h4>Required for next Level:</h4>
<ul class="resources"><li class="wood" title="Building
material"><span class="textLabel">Building material: </span>48</li>
<li class="marble alt" title="Marble"><span class="textLabel">Marble:
</span>9</li>
<li class="time" title="Building time"><span
class="textLabel">Building time: </span>42m</li>
</ul> <ul class="actions">
<li class="upgrade">
<form id="upgradeForm" action="index.php" method="post">
<input name="action" value="CityScreen" type="hidden">
<input name="function" value="upgradeBuilding"
type="hidden">
<input name="id" value="60872" type="hidden">
<input name="position" value="3" type="hidden">
<input name="level" value="1" type="hidden">
</form>
<a href="#upgrade" title="Expand Building"
onclick="Dom.get('upgradeForm').submit();"><span
class="textLabel">Upgrade</span></a>
</li>
<li class="downgrade">
<form id="downgradeForm" action="index.php" method="post">
<input name="view" value="safehouse" type="hidden">
<input name="confirmDowngrade" value="1" type="hidden">
<input name="id" value="60872" type="hidden">
<input name="position" value="3" type="hidden">
<input name="level" value="1" type="hidden">
</form>
<a href="#downgrade" title="Demolish
Building" onclick="Dom.get('downgradeForm').submit();"><span
class="textLabel">Demolish</span></a>
</li>
</ul>
</div>
-------------------------------------------------------------------------------------------
Which are part of this page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="de" />
<meta name="author" content="Gameforge AG" />
<meta name="publisher" content="Gameforge AG" />
<meta name="copyright" content="Gameforge AG" />
<meta name="page-type" content="Browsergame, Browser game" />
<meta name="page-topic" content="Browser game, strategy game, online game" />
<meta name="audience" content="all" />
<meta name="Expires" content="never" />
<meta name="Keywords" content="Ikariam, antique world, strategy game,
play for free, online game, role play game, browser game, game"/>
<meta name="Description" content="Ikariam is a free browser game. The
task is to lead a nation through the ancient world, building up towns,
trade and conquer islands." />
<meta name="robots" content="index,follow" />
<meta name="Revisit" content="After 14 days" />
<title>Ikariam - Live the ancient world!</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link href="/skin/complete-0.1.8.css" rel="stylesheet"
type="text/css" media="screen" />
<script type="text/javascript" src="/js/complete-0.1.8.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
var Event = YAHOO.util.Event,
Dom = YAHOO.util.Dom,
lang = YAHOO.lang;
var LocalizationStrings = new Array();
LocalizationStrings['timeunits'] = new Array();
LocalizationStrings['timeunits']['short'] = new Array();
LocalizationStrings['timeunits']['short']['day'] = 'D';
LocalizationStrings['timeunits']['short']['hour'] = 'h';
LocalizationStrings['timeunits']['short']['minute'] = 'm';
LocalizationStrings['timeunits']['short']['second'] = 's';
LocalizationStrings['language'] = 'en';
LocalizationStrings['decimalPoint'] = '.';
LocalizationStrings['thousandSeperator'] = ',';
/**
* switches one item on and the other off.. but only if they share
the same groupname.
*/
selectGroup = {
groups:new Array(), //[groupname]=item
getGroup:function(group) {
if(typeof(this.groups[group]) == "undefined") {
this.groups[group] = new Object();
this.groups[group].activeItem = "undefined";
this.groups[group].onActivate = function(obj) {};
this.groups[group].onDeactivate = function(obj) {};
}
return this.groups[group];
},
activate:function(obj, group) {
g = this.getGroup(group);
if(typeof(g.activeItem) != "undefined") {
g.onDeactivate(g.activeItem);
}
g.activeItem=obj;
g.onActivate(obj);
}
};
selectGroup.getGroup('cities').onActivate = function(obj) {
YAHOO.util.Dom.addClass(obj.parentNode, "selected");
}
selectGroup.getGroup('cities').onDeactivate = function(obj) {
YAHOO.util.Dom.removeClass(obj.parentNode, "selected");
}
/**
* - will COPY all child nodes of the source-node that are marked
with a CSS class to be child nodes of the target.
* - will purge all children of the TARGET element that are marked
the same special CSS class at each call, so previously copied will be
deleted before copying new
* - expects either an Id or an object.
*/
function showInContainer(source, target, exchangeClass) {
//objects or Id-strings, i don't care
if(typeof source == "string") { source = Dom.get(source); }
if(typeof target == "string") {target = Dom.get(target); }
if(typeof exchangeClass != "string") { alert("Error:
IKARIAM.showInContainer -> Forgot to add an exchangeClass?"); }
//removal
for(i=0; i<target.childNodes.length; i++) {
if(typeof(target.childNodes[i].className) != "undefined" &&
target.childNodes[i].className==exchangeClass) {
target.removeChild(target.childNodes[i]);
}
}
//clone new
for(i=0; i<source.childNodes.length; i++) {
if(typeof(source.childNodes[i].className) != "undefined" &&
source.childNodes[i].className==exchangeClass) {
clone = source.childNodes[i].cloneNode(true);
target.insertBefore(clone, target.firstChild.nextSibling);
}
}
}
selectedCity = -1;
function selectCity(cityNum, cityId, viewAble) {
if(selectedCity == cityNum) {
if(viewAble) document.location.href="?view=city&id="+cityId;
else document.location.href="#";
} else {
selectedCity = cityNum;
}
showInContainer("cityLocation"+cityNum,"information", "cityinfo");
showInContainer("cityLocation"+cityNum,"actions", "cityactions");
var container = document.getElementById("cities");
var citySelectedClass = "selected";
}
//IE6 CSS Background-Flicker fix
(function(){
/*Use Object Detection to detect IE6*/
var m = document.uniqueID /*IE*/
&& document.compatMode /*>=IE6*/
&& !window.XMLHttpRequest /*<=IE6*/
&& document.execCommand ;
try{
if(!!m){
m("BackgroundImageCache", false, true) /* = IE6 only */
}
}catch(oh){};
})();
/* ]]> */
function myConfirm(message, target) {
bestaetigt = window.confirm (message);
if (bestaetigt == true)
window.location.href = target;
}
</script>
</head>
<body id="safehouse">
<script type="text/javascript" src="/js/wz_tooltip.js"></script>
<div id="container">
<div id="container2">
<div id="header">
<h1>Ikariam</h1>
<h2>Live the ancient world!</h2>
</div>
<script src="js/dragdrop-min.js"></script>
<script src="js/slider-min.js"></script>
<script src="js/fixDD.js"></script>
<script src="js/ikslider.js"></script>
<div id="breadcrumbs"><h3>You are here:</h3><a
href="?view=worldmap_iso&islandX=64&islandY=89" title="Back to
the world map"><img src="skin/layout/icon-world.gif" alt="World"
/></a> > <a href="?view=island&id=2405" title="Back to the
island"><img src="skin/layout/icon-island.gif" alt="Throoyios" />
[64:89]</a> > <a href="?view=city&id=60872" class="city"
title="Back to the town">Maitai</a> > <span
class="building">Hideout</span></div><!---------------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// dynamic side-boxes.
//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
-->
<div id="buildingUpgrade" class="dynamic">
<h3 class="header">Expand <a class="help"
href="#helpforbuildingupgrading" title="Help"><span
class="textLabel">Need help?</span></a></h3>
<div class="content">
<div class="buildingLevel"><span class="textLabel">Level </span>1</div>
<h4>Required for next Level:</h4>
<ul class="resources"><li class="wood" title="Building
material"><span class="textLabel">Building material: </span>48</li>
<li class="marble alt" title="Marble"><span class="textLabel">Marble:
</span>9</li>
<li class="time" title="Building time"><span
class="textLabel">Building time: </span>42m</li>
</ul> <ul class="actions">
<li class="upgrade">
<form id="upgradeForm" action="index.php" method="POST">
<input type="hidden" name="action" value="CityScreen">
<input type="hidden" name="function"
value="upgradeBuilding">
<input type="hidden" name="id" value="60872">
<input type="hidden" name="position" value="3">
<input type="hidden" name="level" value="1">
</form>
<a href="#upgrade" title="Expand Building"
onclick="Dom.get('upgradeForm').submit();"><span
class="textLabel">Upgrade</span></a>
</li>
<li class="downgrade">
<form id="downgradeForm" action="index.php" method="POST">
<input type="hidden" name="view" value="safehouse">
<input type="hidden" name="confirmDowngrade" value="1">
<input type="hidden" name="id" value="60872">
<input type="hidden" name="position" value="3">
<input type="hidden" name="level" value="1">
</form>
<a href="#downgrade" title="Demolish
Building" onclick="Dom.get('downgradeForm').submit();"><span
class="textLabel">Demolish</span></a>
</li>
</ul>
</div>
<div class="footer"></div>
</div>
<!---------------------------------------------------------------------------------------------------------------------------------------->
<div class="dynamic" id="reportInboxLeft">
<h3 class="header">Info</h3>
<div class="content">
<p>You can train 1</p>
<ul>
<li>1 are waiting on their training</li>
<li>0 are currently working in the defence</li>
<li>0 are currently in use</li>
</ul>
</div>
<div class="footer"></div>
</div>
<div id="unitConstructionList" class="dynamic">
<h3 class="header">Construction queue <a class="help"
href="#helpforconstrqueue" title="Help">
<span class="textLabel">Help</span></a></h3>
<div class="content">
</div>
</div>
<!---------------------------------------------------------------------------------------------------------------------------------------->
<!---------------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////////
///////////////// the main view. take care that it stretches.
//////////////////////
////////////////////////////////////////////////////////////////////////////////////
-->
<div id="mainview">
<div class="buildingDescription">
<h1>Hideout</h1>
<p>A wise leader always has a eye on both, his allies and his
enemies. The hideout allows you to hire spies who are able to provide
you with information from the inside of other towns. <br />
A larger hideout provides space for more spies.</p>
</div>
<!-- ende .buildingDescription -->
<div class="contentBox01h" id="tearing">
</div> <div class="contentBox01h">
<h3 class="header"><span class="textLabel">Train spy</span></h3>
<div class="content">
<ul id="units">
<li class="unit">
<div class="unitinfo">
<h4>Train spy</h4>
<img src="skin/characters/military/120x100/spy_120x100.gif" />
<p>This citizen is loyal and discreet. An ideal candidate
for a spy. Training time for a spy : </p>
</div>
<!-- Spion ausbilden -->
<div class="forminput">
<a title="Train spy"
href="?action=Espionage&function=buildSpy&id=60872&position=3"
class="button">Train spy</a>
</div>
<div class="costs">
<h5>Costs:</h5>
<ul class="resources">
<li class="gold"><span class="textLabel">Saw Mill: </span>
200 </li>
<li class="glass"><span class="textLabel">Saw Mill: </span>
17 </li>
<li class="time">
14:15 Minutes </li>
</ul>
</div>
</li>
</ul>
</div>
<div class="footer"/></div>
</div>
<div class="contentBox01h">
<h3 class="header"><span class="textLabel">Status of your spies</span></h3>
<div class="content">
<p>Available spies:
<span class="summary">
<span title="Available spies">
<input value="0" readonly="readonly" maxlength="3" size="3"
name="spys" id="spyCount"/></span>/
<span title="Trained spies">
0 </span>
</span>
</p>
</div><!-- .content -->
<div class="footer"></div>
</div><!--.contentbox01h -->
<!-- Spy infobox -->
<div class="contentBox01h">
<h3 class="header"><span class="textLabel">Spy on mission</span></h3>
<div class="content">
<!-- dummy -->
<!-- Einzelenen Spion anzeigen -->
<div style="padding:10px;">None of your spies is currently on a
mission! </div>
</div>
<div class="footer"></div>
</div>
</table>
<br>
</div>
<!-- Navigational elements for changing the city or the view. May
perform different actions on every screen. -->
<div id="cityNav">
<form id="changeCityForm" action="index.php" method="POST">
<fieldset style="display:none;">
<input type="hidden" name="action" value="header" /><a
title="Imprint"
href="http://impressum.gameforge.de/index.php?lang=de&art=impress&special=&&f_text=000000&f_text_hover=804000&f_text_h=9ebde4&f_text_hr=DED3B9&f_text_hrbg=DED3B9&f_text_hrborder=804000&f_text_font=verdana%2C+arial%2C+helvetica%2C+sans-serif&f_bg=DED3B9">Imprint</a>
<input type="hidden" name="function" value="changeCurrentCity" />
<input type="hidden" name="oldView" value="safehouse" />
<input type="hidden" name="id" value="60872" />
<input type="hidden" name="position" value="3" />
</fieldset>
<h3>Town navigation</h3>
<ul>
<li>
<label for="citySelect">Current town:</label>
<select id="citySelect" class="citySelect" name="cityId"
tabindex="1" onchange="this.form.submit()">
<option class="avatarCities" value="43650">Dachary</option>
<option class="avatarCities" value="60872"
selected="selected">Maitai</option>
</select>
</li>
<li class="previousCity"><a href="#changeCityPrevious" tabindex="2"
title="Switch to the last town"><span class="textLabel">Previous
Town</span></a></li>
<li class="nextCity"><a href="#changeCityNext" tabindex="3"
title="Switch to the following town"><span class="textLabel">Next
Town</span></a></li>
<li class="viewWorldmap"><a href="?view=worldmap_iso" tabindex="4"
title="Centre the selected town on the World Map"><span
class="textLabel">Show World</span></a></li>
<li class="viewIsland"><a href="?view=island&id=2405"
tabindex="5" title="Switch to the island map of the selected
town"><span class="textLabel">Show Island</span></a></li>
<li class="viewCity"><a href="?view=city&id=60872" tabindex="6"
title="Inspect the selected town"><span class="textLabel">Show
Town</span></a></li>
</ul>
</form>
</div>
<!-- TODO Goldbalance... -->
<div id="globalResources">
<h3>Resources of your Empire</h3>
<ul>
<li class="transporters" title="Trade ships Available/Total"><a
href="?view=merchantNavy"><span class="textLabel">Trade ships:
</span><span id="value_transAvail" class="transAvail">0</span><span
id="value_transSum" class="transSum">(7)</span></a></li>
<li class="gold" title="Gold"><a href="?view=finances"><span
class="textLabel">Gold: </span><span
id="value_gold">13,118</span></a></li>
<li class="goldBalance negative"><span class="textLabel">Income:
</span>234</li>
</ul>
</div>
<!-- Resources of the city. Finished. Identical on every page. -->
<div id="cityResources">
<h3>Town´s resources</h3>
<ul class="resources">
<li class="population" title="Population">
<span class="textLabel">Population: </span>
<span id="value_inhabitants">115 (250)</span>
</li>
<li class="actions" title="Action Points">
<span class="textLabel">Action Points: </span>
<span id="value_maxActionPoints">6</span>
</li>
<li class="wood" title="Building material">
<span class="textLabel">Building material: </span>
<span id="value_wood" class="">1,375</span>
<div class="tooltip"><span class="textLabel">Storage capacity:
</span>4,576</div>
</li>
<li class="wine" title="Wine">
<span class="textLabel">Wine: </span>
<span id="value_wine" class="">198</span>
<div class="tooltip"><span class="textLabel">Storage capacity:
</span>1,452</div>
</li>
<li class="marble" title="Marble">
<span class="textLabel">Marble: </span>
<span id="value_marble" class="">170</span>
<div class="tooltip"><span class="textLabel">Storage capacity:
</span>1,452</div>
</li>
<li class="glass" title="Crystal Glass">
<span class="textLabel">Crystal Glass: </span>
<span id="value_crystal" class="">0</span>
<div class="tooltip"><span class="textLabel">Storage capacity:
</span>1,452</div>
</li>
<li class="sulfur" title="Sulphur">
<span class="textLabel">Sulphur: </span>
<span id="value_sulfur" class="">0</span>
<div class="tooltip"><span class="textLabel">Storage capacity:
</span>1,452</div>
</li>
</ul>
<script type="text/javascript">
var localTime = new Date();
var startTime = localTime.getTime();
var startResources = 1375.14277777;
var startResourcesDelta = 0.0272222222222;
var resourcesStorage = 4576;
var startTradegood = 197.969166667;
var startTradegoodDelta = 0.00402777777778;
var tradegoodStorage = 1452;
var tradegoodSub = 1;
var tradegoodSubTime = 106;
function updateResources() {
//global: startTime, Dom, resourcesStorage
var currTime = new Date();
deltaTime = (currTime.getTime() - startTime)/1000;
var currResources = startResources + (deltaTime * startResourcesDelta);
Dom.get('value_wood').innerHTML =
number_format(Math.floor(Math.min(currResources, resourcesStorage)));
var ratio = currResources / resourcesStorage;
if (ratio >= 1) {
Dom.get('value_wood').className = "storage_full";
} else if (ratio >= 0.75) {
Dom.get('value_wood').className = "storage_danger";
}
var currTradegood = startTradegood + (deltaTime * startTradegoodDelta);
if (tradegoodSub) {
currTradegood -= Math.floor(tradegoodSub *
Math.floor((tradegoodSubTime+deltaTime)/1200) );
}
Dom.get('value_wine').innerHTML =
number_format(Math.floor(Math.min(currTradegood, tradegoodStorage)));
var ratio = currTradegood / tradegoodStorage;
if (ratio >= 1) {
Dom.get('value_wine').className = "storage_full";
} else if (ratio >= 0.75) {
Dom.get('value_wine').className = "storage_danger";
}
}
var ev_updateResources = setInterval("updateResources()", 2000);
function shortenValue(val, to) {
val = Math.floor(val).toString();
var unit = '';
if (val.length > to) {
if (val.length - 3 < to) {
val = Math.floor(val / Math.pow(10, 3));
unit = 'k';
} else if (val.length - 6 < to) {
val = Math.floor(val / Math.pow(10, 6));
unit = 'm';
}
}
return number_format(Math.floor(val), 0, ',', '.') + unit;
}
var obj_ServerTime = 0;
Event.onDOMReady(function() {
var ev_updateServerTime = setInterval("updateServerTime()", 500);
obj_ServerTime = document.getElementById('servertime');
});
function updateServerTime() {
var currTime = new Date();
currTime.setTime((1205300506000-startTime)+ currTime.getTime()) ;
str = getFormatedDate(currTime.getTime(), 'd.m.Y G:i:s');
obj_ServerTime.innerHTML = str;
}
</script>
</div>
<div id="advisors">
<h3>Overviews</h3>
<ul>
<li id="advCities" ><a
href="?view=tradeAdvisor&oldView=safehouse&id=60872&position=3"
title="Overview of towns and finances" class="normalactive"><span
class="textLabel">Towns</span></a></li>
<li id="advMilitary">
<a
href="?view=militaryAdvisorCombatReports&oldView=safehouse&id=60872&position=3"
title="Military overview" class="normal">
<span class="textLabel">Military</span>
</a>
</li>
<li id="advResearch"><a
href="?view=researchAdvisor&oldView=safehouse&id=60872&position=3"
title="Research overview" class="normalactive"><span
class="textLabel">Research</span></a></li>
<li id="advDiplomacy"><a
href="?view=diplomacyAdvisor&oldView=safehouse&id=60872&position=3"
title="Overview of messages and diplomacy" class="normal"><span
class="textLabel">Diplomacy</span></a></li>
</ul>
</div>
<div id="footer">
<span class="copyright">© 2008 by <a title="Gameforge"
id="gflink" target="_blank"
href="http://www.gameforge.de">Gameforge</a><a
href="/index.php?view=credits" style="margin:0px;">.</a> All rights
reserved.</span>
<a target="_blank" href="http://ikariam.org/rules.php" title="Rules">Rules</a>
<a target="_blank"
href="http://impressum.gameforge.de/index.php?lang=en&art=tac&special=&&f_text=000000&f_text_hover=804000&f_text_h=9ebde4&f_text_hr=DED3B9&f_text_hrbg=DED3B9&f_text_hrborder=804000&f_text_font=verdana%2C+arial%2C+helvetica%2C+sans-serif&f_bg=DED3B9"
title="T&Cs">T&Cs</a>
<a target="_blank"
href="http://impressum.gameforge.de/index.php?lang=en&art=impress&special=&&f_text=000000&f_text_hover=804000&f_text_h=9ebde4&f_text_hr=DED3B9&f_text_hrbg=DED3B9&f_text_hrborder=804000&f_text_font=verdana%2C+arial%2C+helvetica%2C+sans-serif&f_bg=DED3B9"
title="Imprint">Imprint</a>
</div>
<!-- Some generic Divs for styling purposes. -->
<div id="conExtraDiv1"><span></span></div>
<div id="conExtraDiv2"><span></span></div>
<div id="conExtraDiv3"><span></span></div>
<div id="conExtraDiv4"><span></span></div>
<div id="conExtraDiv5"><span></span></div>
<div id="conExtraDiv6"><span></span></div>
</div>
</div>
<!-- Top-tolbar with extragame options. Finished. -->
<div id="GF_toolbar">
<h3>Other Options</h3>
<ul>
<li class="help"><a
href="/index.php?view=informations&articleId=10007&mainId=10007"
title="Frequently asked questions"><span
class="textLabel">F.A.Q.</span></a></li>
<li class="firststeps"><a
href="/index.php?view=informations&articleId=10000&mainId=10000"
title="First steps"><span class="textLabel">First
steps</span></a></li>
<li class="forum"><a href="http://board.ikariam.org" title="Message
Board" target="_blank"><span class="textLabel">Board</span></a></li>
<li class="highscore"><a href="/index.php?view=highscore&showMe=1"
title="Highscore"><span class="textLabel">Highscore</span></a></li>
<li class="options"><a href="/index.php?view=options"
title="Settings"><span class="textLabel">Options</span></a></li>
<li class="logout"><a
href="/index.php?action=loginAvatar&function=logout" title="End game
session"><span class="textLabel">Logout</span></a></li>
<li class="version"><a href="?view=version"
title="Version"><span class="textLabel">v.0.1.8</span></a></li>
<li class="serverTime"><a>World Beta: <span class="textLabel"
id="servertime">12.03.2008 6:41:46</span></a></li>
</ul>
</div>
<!-- Even more generic Divs for styling purposes. -->
<div id="extraDiv1"><span></span></div>
<div id="extraDiv2"><span></span></div>
<div id="extraDiv3"><span></span></div>
<div id="extraDiv4"><span></span></div>
<div id="extraDiv5"><span></span></div>
<div id="extraDiv6"><span></span></div>
<script type="text/javascript">
function makeButton(ele) {
var Event = YAHOO.util.Event;
var Dom = YAHOO.util.Dom;
Event.addListener(ele, "mousedown", function() {
YAHOO.util.Dom.addClass(ele, "down");
});
Event.addListener(ele, "mouseup", function() {
YAHOO.util.Dom.removeClass(ele, "down");
});
Event.addListener(ele, "mouseout", function() {
YAHOO.util.Dom.removeClass(ele, "down");
});
}
function showToolTips() {
var tooltips = Dom.getElementsByClassName ( "tooltip" , "div" ,
document , function() {
Dom.setStyle(this, "display", "none");
})
for(i=0;i<tooltips.length;i++) {
Event.addListener ( tooltips[i].parentNode , "mouseover" , function() {
Dom.getElementsByClassName ( "tooltip" , "div" , this , function() {
Dom.setStyle(this, "display", "block");
});
});
Event.addListener ( tooltips[i].parentNode , "mouseout" , function() {
Dom.getElementsByClassName ( "tooltip" , "div" , this , function() {
Dom.setStyle(this, "display", "none");
});
});
}
}
Event.onDOMReady( function() {
var links = document.getElementsByTagName("a");
for(i=0; i<links.length; i++) {
makeButton(links[i]);
}
showToolTips();
replaceSelect(Dom.get("citySelect"));
});
</script>
</body>
</html>
Received on 2008-03-12