Twitter php Problem
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Twitter php Problem

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    5

    Twitter php Problem

    Hi everyone,

    For a while I'have been looking for a solution for my problem with a twitter php file what used to work at first.

    I' found out that it's because my server doesn't support the old php anymore. So on the internet i' looked for the problem and think
    it's: $content = get_content, but I' don't know that for shure.
    Can anyone help me with a solution or tell me what i' can do to make it work.
    I' got the file from: http://www.republicofcode.com/tutori...r_widget/3.php

    PHP Code:
    <?php
     
    /*
     * @return string
     * @param string $url
     * @desc Return string content from a remote file
     * @author Luiz Miguel Axcar (lmaxcar@yahoo.com.br)
     */

    function get_content($url)
     {
     
    $ch curl_init();

     
    curl_setopt ($chCURLOPT_URL$url);
     
    curl_setopt ($chCURLOPT_HEADER0);

     
    ob_start();

     
    curl_exec ($ch);
    curl_close ($ch);
     
    $string ob_get_contents();

     
    ob_end_clean();

     return 
    $string
    }

    #usage:
     
    $content get_content ("http://twitter.com/statuses/user_timeline.xml?screen_name=blue_chi");
     echo 
    $content;
     
    ?>
    Thanks in advance,
    Marv

  2. #2
    Moderator
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    the _current_ way of doing things in php would be
    Code:
    <?
    $content = file_get_contents("http://....");
    echo $content;
    ?>
    If that does not work, it is most likely because the hosting company has disabled the feature. Now, chances are that they would also disable other features.

    You should perhaps view a php_info file for your site and check whether it has
    fopen_wrappers
    curl

  3. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    5
    I tried but it does not work. I've watched the php_info standing there fopen_wrappers
    curl enabled and on
    The php version of the hosting company has PHP Version 5.3.3-7
    What else can I try?

  4. #4
    Moderator
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    what happens when you add a few test printouts?
    Code:
    <?
    echo "starting<br>";
    $content = file_get_contents("http://....");
    echo "after reading<br>";
    echo $content;
    ?>
    BTW: I have tried the above link with a few likely names, and always get nice xml saying "page does not exist"

  5. #5
    Junior Member
    Join Date
    Aug 2012
    Posts
    5
    Hi,

    I have tried. The result is: HTTP request failed. Maybe twitter has changed its feeds so i need a different parsing to fix it.

  6. #6
    Moderator
    Join Date
    Feb 2001
    Posts
    13,044
    it might be worth trying with an arbitrary website url too, to find out whether it is the hosting company blocking things, or twitter. The url I tried DID return a valid http result, but the result text said "does not exist"

    Musicman

Posting Permissions

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




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com