|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi everybody,
First of all sorry if there is a clear guide to this, but I tried to find something with google but couldn't find it. Maybe it's because I don't know the right terms to describe it. Here is my question. I have a javascript that reads my Twitter statuses from an .xml file, but there is a limit to the amount of posts/statusses it can handle. In default the Twitter xml feed displays 20posts, I need 5. Now here is what I want to do and why this is posted in the PHP forum. I need a php script that reads the xml from http://twitter.com/statuses/user_timeline/user_id.xml, saves it/stores it (only the first 5 statuses) to an index.xml file and refeshes every 15 or 30 minutes. Is this possible? If I didn't gave eough information or you need to know more, please tell me. Best regards, Marcus |
|
#2
|
|||
|
|||
|
A new post since I can't seem to edit my other post:
I found out how to limit the posts/statuses, you just have to add ?count=5 to the Twitter link. So with that out of the way, I just need a script ( I think) that gets the data from the Twitter xml sheets, saves it to twitter.xml on my server and does that every 15 or 30 minutes. If possible it could check if actually a new post was Tweeted? Any help would be appreciated. You might ask why not just use the Twitterlink, but that's because it would slow down my site. Best regards, Marcus |
|
#4
|
|||
|
|||
|
Thank you for your help, sorry for my late response.
Does it require something like that? I've made this script(see below), which reads and then writes the xml file. Isn't there something like this only to execute on each quarter of an hour? An If Else function? I am pretty new to PHP, I am still learning so I don't know if something like that would be possible? If not I guess I'll have to look into curl and maybe PEAR, but I already checked my host if it'd supports PEAR Cache module and it doesn't so that would be a problem. If it could be done in this way I could just include this script in the index file and I would be done, while maybe not the prettiest way to do it, it would do the job. Yours sincerely, Marcus PHP Code:
|
|
#5
|
|||
|
|||
|
I can't seem to edit my last post for some reason, but I've looked into curl and this is what I came up with. Now my question is how to add a 15 to 30 min timeout on reconnecting/redownloading the file?
I can't seem to figure that out, is there a CURLOPT for that? I see something with the modification date in CURL_TIMECOND_IFMODSINCE, CURLOPT_TIMEVALUE and CURLOPT_TIMECONDITION. Yours sincerely, Marcus PHP Code:
|
|
#6
|
||||
|
||||
|
If you have a working script it is just a case of running it automatically using cron.
|
|
#7
|
|||
|
|||
|
Thank you very much, I got it working. It's updating every ten minutes now, I am very glad with the results and I think Twitter will be too
![]() How can I change the status to resolved? |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|