-1

I kinda tried everything.

I'm on Wordpress and using snippets to add code to a specific location on the website and pull some numbers generated on another website. To be more specific it's a counter, I want to sync the numbers on my site to the other site.

I tried jquery, but I don't really know any.

All PHP codes I tried retrieve NULL.

The get page url function doesn't work, so I iframed the page through a proxy hide website and the HTML content does display, just to have it on my domain rather than on another one.

But I just can't seem to pull the content out of the div I want.

I included the DOM document files and tried that code, but it won't display anything.

Any suggestions ?

  • you could try [file_get_contents](http://php.net/manual/en/function.file-get-contents.php). it works with URLs since i use to to loop though a text file of image urls so it can automatically save each image to it's own file (thus saves me going though the motion of right click, save and enter in next url), format wise i don't know how it'll looks so you probably need to do some work with that – Memor-X Aug 15 '16 at 02:17

1 Answers1

0

You have 2 options to do that:

  1. place targeted website url in an iframe - and use "postMessage" to communicate with parent and vice versa (http://javascript.info/tutorial/cross-window-messaging-with-postmessage, https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
  2. create a service (even a simple JSONP service) that will provide the data you want - when being called (Simple jQuery, PHP and JSONP example?)
Community
  • 1
  • 1
Yonatan Ayalon
  • 1,959
  • 18
  • 19
  • I have to mention that I don't have access to the other website. To be more exact, I just want to retrieve the backers on kickstarter for a project, and display them in a counter on my website. Thx for the answer tho, I'll read them well and learn some, my js and php skills are close to 0. – Adrian Cojocariu Aug 15 '16 at 13:09
  • As I mentioned - those are your 2 options to retrieve data from a different domain, due to "Same-origin policy" - https://en.wikipedia.org/wiki/Same-origin_policy. In this case - you need an API (service) that will provide you a way of communication, which for now - Kickstarter doesn't seem to have - http://stackoverflow.com/questions/12907133/does-kickstarter-have-a-public-api, https://www.quora.com/Does-Kickstarter-have-an-API-to-interact-with-the-creator-tools-on-a-Project-Dashboard-once-a-project-is-funded – Yonatan Ayalon Aug 16 '16 at 06:51