EzDevInfo.com

buzz

Buzz is a small but powerful Javascript library that allows you to easily take advantage of the new HTML5 audio element. It tries to degrade silently on non-modern browsers. Buzz, a Javascript HTML5 Audio library

Playing sound with buzz.js

I'm having trouble getting the buzz .play() function to work.

app.js location

app/scripts/app.js

ding.mp3 location

app/scripts/sounds/ding.mp3

var mySound = new buzz.sound( "/sounds/ding.mp3", {
          formats: [ "mp3"],
          preload: true,
          loop: false
        })

        mySound.play();

Can anyone see any problem with my code, or has anyone experienced any recent issues with Buzz?


Source: (StackOverflow)

Code for sharing buttons to facebook, twitter and buzz with counter

I am looking for the code to implement share buttons for twitter, buzz and facebook with a counter like youtube have in their share option, please see the screen shot.

enter image description here

I’ve been looking over some codes but none of them does exactly what I want, either it is a bit square or it is a “like count” to facebook.

I hope one of you could help me with this.

Sincere
- Mestika


Source: (StackOverflow)

Advertisements

Symfony2 : no extension to load Buzz

I'm facing an issue while trying to use Curl in Buzz for Symfony2 (I've finally managed to install it, see this post).

I use it it one on my bundles, and I've updated services.yml, adding these :

# cURL client for Buzz
buzz.client.curl:
class:  Buzz\Client\Curl
public: false
calls:
  - [setVerifyPeer, [false]]

# Buzz browser
buzz.browser:
    class:     Buzz\Browser
    arguments: ['@buzz.client.curl']

And when I go and check my project's page, here's the error I get :

InvalidArgumentException: There is no extension able to load the configuration for "buzz.client.curl" (in myBundle) Looked for namespace "buzz.client.curl", found none

So from what I understand, I have to change one of Buzz's namespace declarations somewhere.
But does anybody know what, and where?


Source: (StackOverflow)

Unknown authorization header error with Buzz API - Using Zend OAuth

Here's the response I keep getting when trying to create a new activity:

{"error":{"errors":[{"message":"Unknown authorization
header","locationType":"header","location":"Authorization"}],"code":
401,"message":"Unknown authorization header"}}

Here's the request I sent (for debugging):

POST /buzz/v1/activities/@me/@self?alt=json HTTP/1.1
Host: www.googleapis.com
Connection: close
Accept-encoding: gzip, deflate
User-Agent: Zend_Http_Client
Content-Type: application/json
Authorization: OAuth
realm="",oauth_consumer_key="eawp.com",oauth_nonce="ce29b04ce6648fbb92efc8f08c1c0091",oauth_signature_method="HMAC-
SHA1",oauth_timestamp="1277934794",oauth_version="1.0",oauth_token="1%2FcBzo5ckGvCAm3wLWh1SDH3xQNoW--
yek1NVfUa1Qqns",oauth_signature="CUezSiMbvxyN1BTeb3uROlIx8gA%3D"
Content-Length: 86

{"data":{"object":{"type":"note","content":"Using OAuth with Twitter -
PHP Example"}}}

All the other requests to get the access_token worked just fine, but now I'm not too sure why it's not working.

** Update

To assist with the debugging a bit more, here is the code in question:

$config = array( 
  //'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER, 
  //'version' => '1.0', 
  //'signatureMethod' => 'HMAC-SHA1', 
  'callbackUrl' => $callback, 
  'siteUrl' => $url, 
  'consumerKey' => $consumerKey, 
  'consumerSecret' => $consumerPass 
); 
$statusMessage = $title; 
$token = unserialize($accessToken); 
$client = $token->getHttpClient($config); 
$client->setUri('https://www.googleapis.com/buzz/v1/activities/@me/ 
@self?alt=json'); 
$client->setMethod(Zend_Http_Client::POST); 
$client->setEncType(Zend_Http_Client::ENC_FORMDATA); 
$client->setHeaders('Content-Type: application/json'); 
                                $data = array( 
                                        'data'   => array( 
                                                'object'  => array( 
                                                        'type'     => 'note', 
                                                        'content'  => $statusMessage, 
                                                ), 
                                        ), 
                                ); 
                                $dataXml = "<entry xmlns='http://www.w3.org/2005/Atom' 
xmlns:activity='http://activitystrea.ms/spec/1.0'> 
                                                                                <activity:object> 
                                                                                    <activity:object-type>http://activitystrea.ms/schema/1.0/ 
note</activity:object-type> 
                                                                                    <content type='html'>$statusMessage<content> 
                                                                                  </activity:object> 
                                                                                </entry>"; 
//$client->setRawData($dataXml); 
$client->setRawData(Zend_Json::encode($data)); 
//$client->setParameterPost("content", $statusMessage); 
$response = $client->request(); 

** As you can see, I did a bit of testing with both the xml+atom and json requests - not much luck with either.

Can you see anything clearly wrong there? And another reminder that I am using Zend_Oauth.


Source: (StackOverflow)

symfony2 Get exact content from BuzzBundle response

How can I get exact content from BuzzBundle without header or other information

currently I am using ,

 $buzz = $this->container->get('buzz');
 $response = $buzz->get('http://api.ipify.org?format=json');
 echo $response;

and output is,

HTTP/1.1 200 OK Server: Cowboy Connection: close Access-Control-Allow-Origin: * Content-Type: text/plain Date: Thu, 13 Nov 2014 14:51:40 GMT Content-Length: 14 Via: 1.1 vegur {"ip":"54.254.210.209"} 

here only {"ip":"111.20.67.90"} is desired response.

or any other way to do so, with different bundle, or i have to use curl directly in PHP code ?


Source: (StackOverflow)

Change defaults for kriswallsmith/Buzz browser

How can i change the request options for a call with a Buzz Browser instance?

I would like to add a longer timeout to the call. Right now it triggers and exception if the legacy server takes longer then x seconds. I would like to prolong this timeout, since the legacy server always returns results, but it can take up to 40 seconds sometimes.

I'm using inside a Symfony2 controller, here's my code:

try {
    $buzz = new Browser();
    $legacyUrl = self::URL_LEGACY_SERVER . $urlSuffix .'?'. http_build_query($request->query->all());
    $legacyResponse = $buzz->get($legacyUrl, array());
} catch (\Exception $e) {
    return $this->sendError('Request to legacy server failed.', 500);
}

Source: (StackOverflow)

Using a proxy server with Buzz

Question: How can a proxy server be used with Buzz?

The commit that added support for proxy can be found here. However, it no longer seems to be available in the latest commit.


Source: (StackOverflow)

What is the cookieJar?

What is the cookie Jar class from Buzz used for?

https://github.com/kriswallsmith/Buzz/blob/master/lib/Buzz/Cookie/Jar.php

For example when I'm making a request:

$browser = new Buzz\Browser();
$response = $browser->get('http://www.google.com');

How should i use the cookie thingy?


Source: (StackOverflow)

Buzz php HTTP-Client:setting a cookie value

is it possible to set a specific Value for the cookie, before fetching a page using the Buzz php light weight client? https://github.com/kriswallsmith/Buzz

i want to set splash = 0 for a specific host, to avoid a pop-up they have.


Source: (StackOverflow)

How to send file data as post parameter in BuzzBrowser post call

I am using Buzz Browser for calling POST method. I am receiving a file from client at one of the end point.

$fileObj = $requestObject->files->get('image_data');

This is correct fileObject. I have verified this using is_file() method.

Now, I have to fire a Buzz Browser post event using this file as parameter.

$headers = array('Content-Type'=>'multipart/form-data'); 
$url = $genericHost . $api; //A valid URL
$params = array('image_data' => $fileObj);//fileObj obtained above

Posting this info using buzzBrowser

$browser->post($url, $headers, $params);

And receiving it as-

$fileObj = $this->get('request')->files->get('image_data');

But, the final $fileObj is NULL.

I tried to dump the $this->get('request')->files-

object(Symfony\Component\HttpFoundation\FileBag)#11 (1) {
["parameters":protected]=>
     array(0) {
    }
}

Means no file is there. What is wrong in my approach?

Edit:1

After debugging more, I found that file object is being sent as normal parameters:

["request"]=>
  object(Symfony\Component\HttpFoundation\ParameterBag)#7 (1) {
    ["parameters":protected]=>
    array(1) {
      ["image_data"]=>
      string(14) "/tmp/php6QLezs"
    }
  }

The header of the request is:

["headers"]=>
   object(Symfony\Component\HttpFoundation\HeaderBag)#13 (2) {
    ["headers":protected]=>
    array(7) {
      ["content-type"]=>
      array(1) {
        [0]=>
        string(70) "multipart/form-data; boundary=----------------------------1b3e33ff2ecb"
      }
      ["content-length"]=>
      array(1) {
        [0]=>
        string(3) "159"
       }
      ["host"]=>
      array(1) {
        [0]=>
        string(16) "host_name"
      }
      ["accept"]=>
        array(1) {
       [0]=>
       string(3) "*/*"
     }
     ["x-php-ob-level"]=>
      array(1) {
       [0]=>
       int(1)
     }
    }

Source: (StackOverflow)

Setter injection doesn't work in Symfony 2 with Buzz browser client?

I'm using kriswallsmith/Buzz browser inside my custom service Skebby. Here is config.yml, please note the call to setVerifyPeer(false) to disable SSL certificate verification:

# cURL client
buzz.client.curl:
    class:  Buzz\Client\Curl
    public: false
    calls:
    - [setVerifyPeer, [false]]

# Buzz browser configured to use cURL client
buzz.browser:
    class:     Buzz\Browser
    arguments: ['@buzz.client.curl']

While Skebby itself is annotated with schmittjoh/JMSDiExtraBundle:

/** @Service("skebby") */
Class Skebby
{
    /**
     * @InjectParams({
     *     "browser"    = @Inject("buzz.browser"),
     *     "translator" = @Inject("translator")
     * })
     *
     * @param \Buzz\Browser $browser
     * @param \Symfony\Bundle\FrameworkBundle\Translation\Translator $translator
     */
    public function __construct(Browser $browser, Translator $translator)
    {
        $this->browser    = $browser;
        $this->translator = $translator;
    }

    public function getCredit()
    {
        var_dump($this->browser->getClient());
        die();
    }
}

Unfortunately the call (inside a controller) $this->get('skebby')->getCredit() shows that something wrong happened with the service container:

object(Buzz\Client\Curl)[4905]
  private 'lastCurl' => null
  protected 'options' => 
    array (size=0)
      empty
  protected 'ignoreErrors' => boolean true
  protected 'maxRedirects' => int 5
  protected 'timeout' => int 5
  protected 'verifyPeer' => boolean true

That is verifyPeer is still true, as the call setVerifyPeer(false) never happened. Is there something wrong with my configuration?

Useful links:


Source: (StackOverflow)

Class 'Geocoder\HttpAdapter\BuzzHttpAdapter' not found

I installed the geocoder-php composer package using php composer.phar install. I'm running on PHP framework Laravel.

Loading composer repositories with package information
Installing dependencies
  - Installing willdurand/geocoder (1.0.10)
    Downloading: 100%

  - Installing kriswallsmith/buzz (v0.7)
    Downloading: 100%

willdurand/geocoder suggests installing guzzle/guzzle (Enabling Guzzle allows you to use the GuzzleHttpAdapter.)
willdurand/geocoder suggests installing zendframework/zend-http (Enabling Zend_Http allows you to use the ZendHttpAdapter)
Writing lock file
Generating autoload files

paths.php

// --------------------------------------------------------------
// The path to the composer vendors directory.
// --------------------------------------------------------------
$paths['composer'] = 'vendor';

public/index.php

// --------------------------------------------------------------
// Autoload composer vendors.
// --------------------------------------------------------------
require path('composer').DS.'autoload.php';

composer.json

{
    "require": {
        "willdurand/geocoder": "@stable",
        "kriswallsmith/buzz": "@stable"
    }
}

Problem: I get the following error when I try to run the example on Geocoder-php's homepage:

Error:

Class 'Geocoder\HttpAdapter\BuzzHttpAdapter' not found

Occurs at:

$adapter  = new \Geocoder\HttpAdapter\BuzzHttpAdapter();

Directory structure

enter image description here

I have already installed Buzz, did I miss out something?


Source: (StackOverflow)

Symfony2 Buzz Https speed issue

We have eventually managed to sort a massive speed issue out with our sites (Symfony2 applications communicating with each other using REST APIs running on a CentOS server).

Switching out using Buzz with using Guzzle seemed to solve the issue.

Someone suggested that Buzz had problems with speed when https is used. I'm not content with this answer because surely someone else would have spotted this and mentioned this on a forum somewhere (Buzz is pretty widely used!!).

Has anyone else experienced this and are there any ideas if there are some configurations issues with https that we missed?


Source: (StackOverflow)

How to add form data on Post requests for Buzz HTTP Client on Laravel?

I'm using Buzz HTTP Client for Laravel.

I have a problem adding form data to my POST requests, since it wasn't specified in it's wiki/documentation.

Listed below are the two ways of sending requests.

Example 1:

$response = Buzz::post('http://api.website.com/login');
//how do I add a "username", and "password" field in my POST request?
echo $response;
echo $response->getContent;

Example 2:

$request = new Buzz\Message\Request('POST', '/', 'http://google.com');
$response = new Buzz\Message\Response();
//how do I add a "username", and "password" field in my POST request?    
$client = new Buzz\Client\FileGetContents();  
$client->send($request, $response);

echo $request;  
echo $response;

Source: (StackOverflow)

SSl Certificate issue with Omnipay and CI

I am trying to make a simple payment through my paypal sandbox from my local machine. I am using the Omnipay library in Codeigniter.

I setup a sandbox account at developer.paypal.com and a test application. This is the code I am using:

$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername([username]);
$gateway->setPassword([password]);
$gateway->setSignature([signature]);
$gateway->setTestMode(true);

$params = array(
    'amount' => '1.00',
    'currency' => 'USD',
    'description' => 'test purchase',
    'transactionId' => '123',
    'transactionReference' => '123ref',
    'returnUrl' => [returnUrl],
    'cancelUrl' => [cancelUrl],
);

$response = $gateway->purchase($params);

I am getting the following error:

Fatal error: Uncaught exception 'Buzz\Exception\ClientException' with message 'SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' in...

I installed omnipay using composer with something called BUZZ. I am pretty new to doing paypal transactions online and not sure If I need to setup a local ssl certificate. If I do, can someone point me in the direction for setting that up?

Thanks.


Source: (StackOverflow)