Jump to content

How to get xml data from another website that I own?


shadiadiph

Recommended Posts

How can I open another website owned by myself and return the xml data?

 

I know i could do it with javascript but I'd rather do it in php with one call if possible.

 

Been toying with this all afternoon and getting nowhere maybe just too tired been at it 15 hours today already.

 

I have website A has data on it website B needs to send an ipaddress to site A in order for the functions on the page to populate the xml

 

I started with fsockopen but i think its the wrong way to go about it???

Link to comment
Share on other sites

Sorry to give you an idea i need to get this xml data and pretty much preserve it in the same format if possible any ideas can curl produce such an effect in one chunk?

 

header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='ISO-8859-1'?>";
echo "<geoipdata>";
echo "<countries>$countries</countries>";
echo "<countrycode>$countrycode<countrycode>";
echo "<country>$country</country>";
echo "<states>$states</states>";
echo "<state>$state</state>";
echo "<cities>$cities</cities>";
echo "<city>$city</city>";
echo "<postal>$postal</postal>";
echo "<latitude>$latitude</latitude>";
echo "<longitude>$longitude</longitude>";
echo "<metrocode>$metrocode</metrocode>";
echo "<areacode>$areacode</areacode>";
echo "</geoipdata>";

Link to comment
Share on other sites

Thank Kat that I was looking at that earlier but are you suggesting I Curl it first right?

Or I noticed there was a way of opening another site in simplexml()?

Only problem is if opening it through simpleXML it's a php page not an XML page

I am sure I'll get there eventually. I always do after alot of cursing and it's usually the simplest way that works right :)

Link to comment
Share on other sites

Yes the outputs in XML once the ipaddress has run through the functions I did look at the link you posted earlier quickly but It seemed focused on printing RSs feeds and basic XML data manipulation within a page from the same site if my memory is correct the problem is site a to b and my reseller acct is with ENom alot of restrictions I have php but only what I am allowed to have ouch ;)

Link to comment
Share on other sites

mm kinda got it working simplexml_load_file does not seem to work when opening a php file but fopen and fread followed by simplexml_load_string($freadvalue) seems to be working fine.

 

The one problem I have now is how to put an array into an xml node so when read it can be read as an array? at the moment i insert the variable in the <states>$states</states> but when i read it it just says Array when i print_r it it only has a value of [0] =>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.