Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

returning "Array" #12

Open
maxmitch opened this issue Jun 21, 2014 · 15 comments
Open

returning "Array" #12

maxmitch opened this issue Jun 21, 2014 · 15 comments

Comments

@maxmitch
Copy link

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?

@Falicon
Copy link
Owner

Falicon commented Jun 21, 2014

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 [email protected] 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.

@maxmitch
Copy link
Author

I did try $results[0] ?

@Falicon
Copy link
Owner

Falicon commented Jun 21, 2014

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).

@websolprov
Copy link

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] => )

@websolprov
Copy link

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.

@websolprov
Copy link

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.

@websolprov
Copy link

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.

@dotcomUNDERGROUND
Copy link

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

@dotcomUNDERGROUND
Copy link

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

code:

result:
Array ( [status_code] => 500 )

@Falicon
Copy link
Owner

Falicon commented May 17, 2015

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 <[email protected]

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).

@dotcomUNDERGROUND
Copy link

I have the following properly set:
bitlyKey
bitlyLogin
bitly_clientid
bitly_secret

@websolprov
Copy link

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

From: Kevin Marshall [mailto:[email protected]]
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 <[email protected]
mailto:[email protected]%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.

@nikokauranen
Copy link

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?

@diogo10
Copy link

diogo10 commented Apr 22, 2016

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.

@phplicengine
Copy link

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

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

No branches or pull requests

7 participants