Jump to content

xmlhttp.open to GET element from an XML in another server

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Codeturk

Codeturk

    Newbie

  • Members
  • Pip
  • 5 posts
Is there anyway to get around this limitation with another method?
I am trying to run the script from my own web server to get data from smugmug servers (where I cannot create custom html pages) Smugmug is oEmbed friendly, but xmlhttp.open is not getting data from a different server, I assume due to limitation/security of javascript - not due to any limitation by smugmug.

I am trying to get the data, so I can create simple php script to write this grabbed data into an .html (which is a different topic under php forum)

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#
fetch the xml with php instead one of the many get file functions (get_file_contents, curl and more), and then let your javascript fetch it from your local server.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#3
Codeturk

Codeturk

    Newbie

  • Members
  • Pip
  • 5 posts
Hi Orjan, that's a sweet looking avatar.
I tried get file contents and it is messing up the data for some reason.

It is parsing the html embed code wihin the XML incorrectly, it adds <![CDATA[ before <object and renders it useless.

You can take a look at it here, along with the XML I am trying to grab http://www.dsblogs.com/dom.php
I tried both local and remote xml files to make sure it wasn't the server:

<?php

$homepage = file_get_contents('http://www.dsblogs.com/oEmbed.api.smugmug.com.xml');

echo $homepage;

?>


<?php

$homepage = file_get_contents('http://api.smugmug.com/services/oembed/?url=http%3A%2F%2Fnewpics.huntsvillecarscene.com%2FHuntsville-Car-Scene%2FEvents%2FFirst-Look-2011-Audi-A8-and/13806770_5tnLh%231011625809_9t4dH');

echo $homepage;

?>







1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users