Here is my code(although I have tried a miriad of variations):
PHP Code:
$timeout = 0; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, "http://twitter.com/statuses/public_timeline.json"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $twitter = curl_exec($ch); curl_close($ch); $twitterArray = json_decode($twitter); foreach ($twitterArray as $tweet){ $i++; $user = $tweet->user; $id[$i] = $user->id; $imageURL[$i] = "\"".$user->profile_image_url."\""; $url[$i] = $user->url; $name[$i] = $user->screen_name; $description[$i] = $user->description; $created[$i] = $user->created_at; $followers[$i] = $user->followers_count; $friends[$i] = $user->friends_count; echo(" <pre> Record #: $i<br> Image: $image[$i]<br> URL: $url[$i]<br> Name: $name[$i]<br> Description: $description[$i]<br> Created on: $created[$i]<br> Followers: $followers[$i]<br> Friends: $friends[$i]<br><br> </pre> "); $ch = curl_init(); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_BINARYTRANSFER, 1); curl_setopt ($ch, CURLOPT_URL,$imageURL[$i]); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 60); $imageData = curl_exec($ch); echo 'image is: ', htmlentities(substr($imageData, 0, 4)), "...<br />\n"; curl_close($ch); $image = imagecreatefromstring($imageData); $Orbimage = "http://www.webmaster-talk.com/images/twitter/".$id[$i].".png"; $Orbback = imagecreatefrompng("../images/main/OrbBack.png"); list($current_width, $current_height) = getimagesize($twitterImage); $Orbfront = imagecreatefrompng("../images/main/OrbFront.png"); imagecopy($Orbback,$imageData,50,50,$current_width/2,$current_height/2,$current_width,$current_height); imagecopy($Orbback,$Orbfront,0,0,0,0,100,100); imagesavealpha($Orbback, true); imagepng($Orbback,$Orbimage); } ?>
here is the url: http://orbzorbz.com/php/twitterData.php
I am lost, have tried file_get_contents(url) with no luck and yes I have configured php to allow file open. ???
P.S. the string is indeed empty, even though i get no "cannot open url" error. I can enter url in browser and display image however!
So I guess the real question is why is it empty? I have put in an html "echo" to display pic, it works just fine, of course that is client side.
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!
Last edited by Sleeping Troll; 06-06-2009 at 08:02 PM..
|