Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using PHP to get data from feed

    This one is tough.

    I need to get the data from a feed that is embedded like this:

    <script src="http://example.com/0809897.js"></script>

    I don't even know where to start, can somebody help me please?

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Location
    Quebec
    Posts
    261
    Thanks
    6
    Thanked 7 Times in 7 Posts
    Maybe cURL or MagpieRSS is what your looking for.

    Here is a simply tutorial on link/content scraping using cURL. Myself, I've barely touched cURL, but I'm pretty sure it can do what you need.
    http://www.merchantos.com/makebeta/p...inks-with-php/

  • #3
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post
    So is this some kind of ajax stuff? then it might not be easy to scrape that with something like curl, if you have a larger example it might be easier to help you.
    m6.net - windows webhosting
    my readlog - what I read

  • #4
    New Coder
    Join Date
    Dec 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Skyrider, for example this article feed:

    Code:
    <script language="javascript" src="http://js.amazines.com/articlefeed.js?c=,68&t=1&b=1&m=5&h=3&r=0&a=&uid=a62ff736-bcd5-48a8-9d2d-2ad50964deb9"></script>

  • #5
    Regular Coder
    Join Date
    Dec 2007
    Location
    Nebraska
    Posts
    113
    Thanks
    0
    Thanked 2 Times in 2 Posts
    The Javascript won't execute server side so using CUrl won't help. That is unless you dig into the script a little further and find out where and how it's getting the raw data in the first place. If that data is accessible, then you can pull it that way.

    Keep in mind however, information like that isn't necessarily free. If the information provided by that script took money and resources to compile, the company or individual that wrote the script, may not appreciate your circumvention of all their efforts to at least identify themselves as the provider. If they compiled the data and are serving it up, they own it.

    If they discover that you are pulling the data in a way they would prefer you not, they can cut you off. If they have an API/developer key/registration process or can provide the means and permission to access the data differently, that's a much better route.
    Deliver yesterday, code today, think tomorrow.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •