Search Results

Search found 2 results on 1 pages for 'bardockyo'.

Page 1/1 | 1 

  • Twitter API PHP script error

    - by bardockyo
    I am having issues with my php script that I am using for gathering a users followers by accessing the twitter API. The script works fine for a user that has < 5000 followers but I tried adjusting the script using cursors to collect the complete set of users. Here is my script: <?php $cursor = -1; $file = fopen ('ids.csv', 'w+'); fwrite($file, "User id\n\r"); for ($i = 0; $i <= 1; $i++) { $xml = getFollowers($cursor); foreach ($xml->ids->id as $id) { fwrite($file, $id . ", "); fwrite($file, "\n"); } $cursor = $xml->next_cursor; } function getFollowers ($cursor) { $xmldata = 'https://api.twitter.com/1/followers/ids.xml?cursor='.$cursor.'&screen_name=microsoft'; $open = fopen($xmldata, 'r'); $content = stream_get_contents($open); fclose($open); $xml = simplexml_load_file($xmldata); return $xml; } ?> I am getting an error Warning: fopen("https://api.twitter.com/1/followers/ids.xml?cursor=-1&screen_name=microsoft") failed to open stream HTTP request failed bad request warning: stream_get_contents() expects parameter 1 to be resource, boolean given. Any ideas?

    Read the article

  • Need help finding a unique value in array

    - by bardockyo
    My code is complete minus one little flaw. It searches the array and prints out which values are unique, however it always counts the first entry as unique even if it is followed by the same value. Can anyone look at my code and tell me which part is messing this up because it is driving me crazy. #include <stdio.h> #define size 7 int main(void) { int array1[size], target, answer, found, x, k, prev, count =1, i; printf("Please input %d integers: ", size); scanf("%d", &target); for(x = 0; x < size; x++) { scanf("%d", &array1[x]); } prev = array1[0]; for (i = 1; i < size; i++) { if (array1[i] == prev) { count++; } else { if (count < 2) printf("%d=%d\n", prev, count); prev = array1[i]; count = 1; } } if (count < 2) { printf("%d=%d\n", prev, count); } return 0; }

    Read the article

1