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

EpiFoursquare.php support upload photo #15

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

shizhao
Copy link

@shizhao shizhao commented Mar 22, 2011

@@ -77,9 +77,9 @@ class EpiFoursquare
77 77
return $this->request('GET', $endpoint, $params);
78 78
}
79 79

80

  • public function post($endpoint, $params = null)
    80
  • public function post($endpoint, $params = null, $up = 0)
    81 81
    {
    82
  • return $this->request('POST', $endpoint, $params);
    82
  • return $this->request('POST', $endpoint, $params, $up);
    83 83
    }
    84 84

85 85
public function __construct($clientId = null, $clientSecret = null, $accessToken = null)
... ...
@@ -97,7 +97,7 @@ class EpiFoursquare
97 97
return "{$this->apiUrl}{$endpoint}";
98 98
}
99 99

100

  • private function request($method, $endpoint, $params = null)
    100
  • private function request($method, $endpoint, $params = null, $up = 0)
    101 101
    {
    102 102
    if(preg_match('#^https?://#', $endpoint))
    103 103
    $url = $endpoint;
    ... ...
    @@ -128,7 +128,11 @@ class EpiFoursquare
    128 128
    curl_setopt($ch, CURLOPT_INTERFACE, $_SERVER ['SERVER_ADDR']);
    129 129
    if($method === 'POST' && $params !== null)
    130 130
    {
    131
  •  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
    
    131
  •  if ($up == 0) {
    
    132
  •    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
    
    133
  •  } else {
    
    134
  •    curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
    
    135
  •  }
    
    132 136
    }
    133 137

134 138
$resp = new EpiFoursquareJson(EpiCurl::getInstance()->addCurl($ch), $this->debug);

@jmathai
Copy link
Owner

jmathai commented Mar 22, 2011

What happened to this diff??? :)

I'll pull down your changes and have a look.

Really appreciate the contribution :). - Thanks.

@henrychen95
Copy link

I referenced the sample code at https://github.com/jmathai/foursquare-async/pull/15/files
I can get response, but I found photo name are all without jpg
response as follow could you help me to check this? thank you very much.

stdClass Object
(
[photo] => stdClass Object
(
[id] => 4e56035062e1e9bb42679281
[createdAt] => 1314259792
[url] => https://playfoursquare.s3.amazonaws.com/pix/534L2C4GXSIIBTRAIRVLA11BMD5WWSIV4DVJNVJCLLP1RQPP
[sizes] => stdClass Object
(
[count] => 4
[items] => Array
(
[0] => stdClass Object
(
[url] => https://playfoursquare.s3.amazonaws.com/pix/534L2C4GXSIIBTRAIRVLA11BMD5WWSIV4DVJNVJCLLP1RQPP
[width] => 640
[height] => 960
)

                        [1] => stdClass Object
                            (
                                [url] => https://playfoursquare.s3.amazonaws.com/derived_pix/534L2C4GXSIIBTRAIRVLA11BMD5WWSIV4DVJNVJCLLP1RQPP_300x300.
                                [width] => 300
                                [height] => 300
                            )

                        [2] => stdClass Object
                            (
                                [url] => https://playfoursquare.s3.amazonaws.com/derived_pix/534L2C4GXSIIBTRAIRVLA11BMD5WWSIV4DVJNVJCLLP1RQPP_100x100.
                                [width] => 100
                                [height] => 100
                            )

                        [3] => stdClass Object
                            (
                                [url] => https://playfoursquare.s3.amazonaws.com/derived_pix/534L2C4GXSIIBTRAIRVLA11BMD5WWSIV4DVJNVJCLLP1RQPP_36x36.
                                [width] => 36
                                [height] => 36
                            )

                    )

            )

        [source] => stdClass Object
            (
                [name] => xxxxxx
                [url] => xxxxxxxxx
            )

    )

)

@henrychen95
Copy link

my code as follow
$para = array();
$para['venueId'] = $_POST['vid'];
$para['photo'] = '@'.$_FILES['photo']['tmp_name'];
$foursquarePhotoProcess = $this->fs->post('/photos/add',$para,$up=1);
$fsPRes = $foursquarePhotoProcess->response;

@jmathai
Copy link
Owner

jmathai commented Aug 25, 2011

The library doesn't parse the response so I'm not sure why the extension is
chopped off. You can print out the ->responseText value and see exactly what
Foursquare returns.

If you see the extension stripped out then I'd check with the foursquare api
group.
http://groups.google.com/group/foursquare-api?pli=1

On Thu, Aug 25, 2011 at 1:18 AM, henrychen95 <
[email protected]>wrote:

my code as follow
$para = array();
$para['venueId'] = $_POST['vid'];
$para['photo'] = '@'.$_FILES['photo']['tmp_name'];
$foursquarePhotoProcess = $this->fs->post('/photos/add',$para,$up=1);
$fsPRes = $foursquarePhotoProcess->response;

Reply to this email directly or view it on GitHub:
#15 (comment)

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

Successfully merging this pull request may close these issues.

3 participants