open All Channels
seplocked EVE Technology Lab
blankseplocked How to get Corp ID using its name (PHP please)?
 
This thread is older than 90 days and has been locked due to inactivity.


 
Author Topic

Sleepy Fly
Posted - 2008.12.16 02:38:00 - [1]
 

the question is simple
i need to get image from the site http://clg.eve-metrics.com/generator using the name of corporation :)
so thereforei need to get corp ID using its name

can someone wright here few needed lines of PHP script?

Gemberkoekje
Gallente
Foundation
Posted - 2008.12.16 13:22:00 - [2]
 

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.eve-online.com/eve/CharacterID.xml.aspx?names=Eve%20Defence%20Force");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$prestr = "characterID=\"";
$prelen = strlen($prestr);
$tmpstr = strstr($ch,$prestr);
$tmppos = strpos($tmpstr,"\" />", $prelen);
$corpID = substr($tmpstr, $prelen, $tmppos - $prelen);


something like that.

Solo Drakban
GoonWaffe
Goonswarm Federation
Posted - 2008.12.16 16:24:00 - [3]
 

preg_match_all() would probably be easier and allow for multiple returns. Something like:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.eve-online.com/eve/CharacterID.xml.aspx?names=Eve%20Defence%20Force,GoonFleet,GoonSwarm");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
preg_match_all( '/<row name=".*" characterID="([0-9]+)"/', $response, $matches );

Now $matches[>=1] contains every ID returned.

Sleepy Fly
Posted - 2008.12.16 17:58:00 - [4]
 

Thank you!
gonna redo kb now)


 

This thread is older than 90 days and has been locked due to inactivity.


 


The new forums are live

Please adjust your bookmarks to https://forums.eveonline.com

These forums are archived and read-only