|
YFrogAPI
yfrog APIyfrog offers an API for developers. Please see links on the left for documentation. To start using the API, request a key. When uploading large video files, please consider using ChunkedVideoUploadApiI, which allows you to resume in case on interruption. yfrog has full support for OAuth Echo. | |
► Sign in to add a comment
I want post yfrog.com using Oauth then, HTTP response is "<err code="1001" msg=" Invalid username or verification URL specified"/>" Why do I get this message?
Como poner esta pag en idioma espaƱol. gracias.
where is RSS ?
Is there a yfrog RSS feed?
By jenifer.lopez34@gmail.com
Is there ayfrog RSS feed ??
Is there a way to get a xml (or other format) list with the last user's pictures uploaded? I can't find it!!
sepi
How i connect RSS
Hi, i'm using the upload api. How can i determine the image format when trying to upload image (blob)?
Tnx, Rony
How to add this service to our twitter client ? Please help me
Can anyone help me with this one?
403: Client must provide a 'status' parameter with a value.
function twitter_yfrog_page($query) { if (user_type() == 'oauth') {
//Has the user submitted an image and message? if ($POST['message']) { $yfrogURL = 'http://yfrog.com/api/xauth_upload'; //Set the initial headers $header = array( 'X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.xml', 'X-Verify-Credentials-Authorization: OAuth realm="http://api.twitter.com/"' ); //Using Abraham's OAuth library require_once('OAuth.php'); // instantiating OAuth customer $consumer = new OAuthConsumer(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET); // instantiating signer $sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); // user's token list($oauth_token, $oauth_token_secret) = explode('|', $GLOBALS['user']['password']); $token = new OAuthConsumer($oauth_token, $oauth_token_secret); // Generate all the OAuth parameters needed $signingURL = 'https://api.twitter.com/1/account/verify_credentials.xml'; $request = OAuthRequest::from_consumer_and_token($consumer, $token, 'GET', $signingURL, array()); $request->sign_request($sha1_method, $consumer, $token); $header1? .= ", oauth_consumer_key=\"" . $request->get_parameter('oauth_consumer_key') ."\""; $header1? .= ", oauth_signature_method=\"" . $request->get_parameter('oauth_signature_method') ."\""; $header1? .= ", oauth_token=\"" . $request->get_parameter('oauth_token') ."\""; $header1? .= ", oauth_timestamp=\"" . $request->get_parameter('oauth_timestamp') ."\""; $header1? .= ", oauth_nonce=\"" . $request->get_parameter('oauth_nonce') ."\""; $header1? .= ", oauth_version=\"" . $request->get_parameter('oauth_version') ."\""; $header1? .= ", oauth_signature=\"" . urlencode($request->get_parameter('oauth_signature')) ."\""; //open connection $ch = curl_init();
//Set paramaters curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
//set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$yfrogURL);
//yFrog requires the data to be sent as POST $media_data = array( 'media' => '@'.$FILES['media']['tmp_name'], 'message' => ' ' . stripslashes($POST['message']), //A space is needed because yfrog b0rks if first char is an @ 'api_key' =>yfrog_API_KEY );
curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS,$media_data); //execute post $result = curl_exec($ch); $response_info=curl_getinfo($ch); //close connection curl_close($ch); if ($response_info['http_code'] == 200) { //Success //Decode the response $json = json_decode($result); $id = $json->response->media->id; $yfrogURL = $json->response->media->url; $text = $json->response->media->text; $message = trim($text); //Send the user's message to twitter $request = API_URL.'statuses/update.json'; $post_data = array('source' => 'dabr', 'status' => $message); $status = twitter_process($request, $post_data); //Back to the timeline twitter_refresh("yfrog/confirm/$id"); } else { $content = "<p>yfrog upload failed. No idea why!</p>"; $content .= "<pre>";
$json = json_decode($result); $content .= "<br / ><b>message</b> " . urlencode($_POST['message']); $content .= "<br / ><b>json</b> " . print_r($json); $content .= "<br / ><b>Response</b> " . print_r($response_info); $content .= "<br / ><b>header</b> " . print_r($header); $content .= "<br / ><b>media_data</b> " . print_r($media_data); $content .= "<br /><b>URL was</b> " . $yfrogURL; $content .= "<br /><b>File uploaded was</b> " . $_FILES['media']['tmp_name']; $content .= "</pre>"; } } elseif ($query[1] == 'confirm') { $content = "<p>Upload success. Image posted to Twitter.</p>"; } else { $content = "<form method='post' action='yfrog' enctype='multipart/form-data'>Image <input type='file' name='media' /><br />Message (optional):<br /><textarea name='message' style='width:90%; max-width: 400px;' rows='3' id='message'></textarea><br><input type='submit' value='Send'><span id='remaining'>110</span></form>"; $content .= js_counter("message", "110"); }
return theme('page', 'yfrog Upload', $content); } }