Jump to content

theuser26

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by theuser26

  1. Hello guys.

     

    Is it possible to catch a fatal error and then do something?

     

    What I need to do is to catch the error and run the script a second time, before the first execution ends.

     

    Kind regards and thanks for advance.

  2. Hello guys, i need to create a code for making connections with SSL servers (particularly SMTPS and POP3S) and i know about the existence of OpenSSL extension.

     

    However, i'm in doubt about a basic issue:

     

    1. Is this extension useful for creating SSL clients or SSL servers?

     

    I'm not a SSL expert, so maybe i'm misunderstanding something; i hope you can help me.

     

    Kind regards.

  3. Hello guys, I am trying my best to upload images to Twitpic by using PHP and OAuth (PECL extension) and I keep getting "Could not authenticate you (header rejected by twitter)".

     

    Can someone tell me what am I doing wrong?

     

    This is my code so far:

     

    $arguments[] = "oauth_consumer_key=" . $this->consumer_key;
    $arguments[] = "oauth_nonce="        . md5(time());
    $arguments[] = "oauth_signature_method=HMAC-SHA1";
    $arguments[] = "oauth_timestamp="    . time();
    $arguments[] = "oauth_token="        . $this->oauth_token;
    $arguments[] = "oauth_version=1.0";
    
    $sbs       = oauth_get_sbs("POST", "http://api.twitpic.com/2/upload.xml", $arguments);
    $signature = urlencode(base64_encode(hash_hmac("sha1", $sbs, $this->consumer_secret . "&", true)));
    
    $arguments[] = "oauth_signature="    . $signature;
    
    sort($arguments);
    
    $headers[] = "X-Auth-Service-Provider: http://api.twitter.com/1/account/verify_credentials.json";
    $headers[] = "X-Verify-Credentials-Authorization: OAuth\n" . implode(",\n", $arguments);
    
    $postfields["key"]     = $this->api_key;
    $postfields["media"]   = "@$image";
    $postfields["message"] = $message;
    
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "http://api.twitpic.com/2/upload.xml");
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_VERBOSE, true);
    curl_setopt($curl, CURLOPT_HEADER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    echo curl_exec($curl);

     

    Kind regards and thanks in advance.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.