Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

urlencoding of status while picture upload #186

Open
aboosoyeed opened this issue Oct 5, 2013 · 3 comments
Open

urlencoding of status while picture upload #186

aboosoyeed opened this issue Oct 5, 2013 · 3 comments

Comments

@aboosoyeed
Copy link

$twitterInfo = $twitterObj->post('/statuses/update_with_media.json',
Array('status' => $status,
'@media[]'=>"@".$photo));

this is uploading perfectly but the status is getting url encoded

eg "this was kinda strange" became
"this%20was%20kinda%20strange"

@aboosoyeed
Copy link
Author

for now i have down a work around by doing
if($isMultipart)
{
if(isset($params['request']['status']))
$params['request']['status']=urldecode($params['request']['status']);
......
}

in
protected function httpPost() in EpiOAuth.php

@donohoe
Copy link

donohoe commented May 23, 2014

Thank you. I came here to flag this (without knowing the workaround) and this proved very helpful.

My full modified httpPost function now reads as:

  protected function httpPost($url, $params = null, $isMultipart)
  {
    $this->addDefaultHeaders($url, $params['oauth']);
    $ch = $this->curlInit($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    // php's curl extension automatically sets the content type
    // based on whether the params are in string or array form

    /* Manual Edit as per: https://github.com/jmathai/twitter-async/issues/186 */

    if ($isMultipart) {
        if (isset($params['request']['status'])) {
            $params['request']['status']=urldecode($params['request']['status']);
        }
        curl_setopt($ch, CURLOPT_POSTFIELDS, $params['request']);
    } else {
        curl_setopt($ch, CURLOPT_POSTFIELDS, $this->buildHttpQueryRaw($params['request']));
    }

    /* End Edit */

    $resp = $this->executeCurl($ch);
    $this->emptyHeaders();

    return $resp;
  }

wayne530 added a commit to revinate/twitter-async that referenced this issue Feb 6, 2015
@wayne530
Copy link

wayne530 commented Feb 6, 2015

@jmathai Any particular reason this hasn't been addressed?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants