Falicon / BitlyPHP

A simple PHP library for interacting with the Bit.ly API (including the new OAuth endpoints)

Home Page:http://falicon.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

returning "Array"

maxmitch opened this issue · comments

require_once('bitly.php');

$results = bitly_v3_shorten('http://www.tragicclothing.co.uk/bitsandbobs.php#martello-tower-y-by-billings-jackson-design', '83dsfreu61b8b7081e950d6c1383fb86d3d8334', 'j.mp');

when I use echo $results; the php page returns Array.

And when I use echo $results[0]; the php page returns nothing?

Why is this not working?

its prob. a ref. array...try $results->[0] and see if that returns what you would expect.

  • Kevin

Sent from my iPad

On Jun 21, 2014, at 6:18 AM, Max Mitchell notifications@github.com wrote:

require_once('bitly.php');

$results = bitly_v3_shorten('http://www.tragicclothing.co.uk/bitsandbobs.php#martello-tower-y-by-billings-jackson-design', '83dsfreu61b8b7081e950d6c1383fb86d3d8334', 'j.mp');

when I use echo $results; the php page returns Array.

And when I use echo $results[0]; the php page returns nothing?

Why is this not working?


Reply to this email directly or view it on GitHub.

I did try $results[0] ?

The difference is the arrow before the bracket $results->[0] vs $ results[0]

The first is for a reference to an array, the second is actually an
array...it's a confusing thing that mostly has to do with memory management
in the background.

I did try $results[0] ?


Reply to this email directly or view it on GitHub
#12 (comment).

I have the same problem, it was working previously, and I tested that curl is working:

function _isCurl(){
return function_exists('curl_version');
}

echo "Curl enabled: " . _isCurl();

I even tried changing the $var->{}->{} notation to $var[][] and still nothing, when i print_r the output I just get:

Array ( [status_code] => )

If I echo display the url that is passed to curl and then put this into a browser I get a successful shortlink, and a 200 status code but it doesnt explain how or why the php curl call doesnt work.

If I print the $ch variable I get Resource id #53 so this isnt generating an error, but if I execute:

$output = curl_exec($ch);
echo "output: ";
print_r($output);

I just get blank, no errors.

Hmmm seems to be that CurlSSL wasnt enabled on the server, did this in Apache and the SSL call to the shorten function seems to work now.

I am also getting the same error.

code:
include_once('bitly.php');
$result = bitly_v3_shorten('http://getbootstrap.com/2.3.2/');
print_r($result);

result shows:
Array ( )

I have checked phpinfo() and curls shows up enabled with ssl

I tried again by uploading the file again and creating a new test file.

code:

result:
Array ( [status_code] => 500 )

The result is an array because there appears to be an error (the
status_code listed at 500)...that specific error probably has to do with
authentication (i.e. you are not properly authorized when you make the
request)...it looks like the 'shorten' endpoint now requires auth (
http://dev.bitly.com/links.html#v3_shorten ).

On Sat, May 16, 2015 at 5:22 PM, dotcomUNDERGROUND <notifications@github.com

wrote:

I tried again by uploading the file again and creating a new test file.

code:

result:
Array ( [status_code] => 500 )


Reply to this email directly or view it on GitHub
#12 (comment).

I have the following properly set:
bitlyKey
bitlyLogin
bitly_clientid
bitly_secret

WHy on earth am I being copied to all this? remove me immediately!

From: Kevin Marshall [mailto:notifications@github.com]
Sent: 17 May 2015 01:04
To: Falicon/BitlyPHP
Cc: Alex Cope-Norris - WebSolProv
Subject: Re: [BitlyPHP] returning "Array" (#12)

The result is an array because there appears to be an error (the
status_code listed at 500)...that specific error probably has to do with
authentication (i.e. you are not properly authorized when you make the
request)...it looks like the 'shorten' endpoint now requires auth (
http://dev.bitly.com/links.html#v3_shorten ).

On Sat, May 16, 2015 at 5:22 PM, dotcomUNDERGROUND <notifications@github.com
mailto:notifications@github.com%0b> wrote:

I tried again by uploading the file again and creating a new test file.

code:

result:
Array ( [status_code] => 500 )


Reply to this email directly or view it on GitHub
#12 (comment).


Reply to this email directly or view it on GitHubhttps://github.com//issues/12#issuecomment-102712727.

Getting the same error as above, the file returns just "Array". I've triple-checked everything, but still no luck, any idea what could be going on?

Hi guys, how can I get just the url? I've tried results[0], results->[0]....just to test if I can get some part of the array....but no luck.

Our lib is for Bitly Api v4.
https://github.com/phplicengine/bitly