Welcome Guest, Not a member yet? Register   Sign In
bit.ly v3 API Library
#1

[eluser]patrickpopowicz[/eluser]
A simple library for accessing the V3 of the bit.ly API using CodeIgniter and cURL.

The code is attached and also up with documentation on Github, at http://bit.ly/aUWz2Y.

Feedback welcome and appreciated,
Patrick
#2

[eluser]CIfan[/eluser]
Thx!
#3

[eluser]ImmergeTech[/eluser]
I've put bitly.php into application/config
I've put Bitly.php into application/libraries


I put my API key and username into the bitly.php config file.

In my controller I put:
Code:
$this->load->library('bitly');
$data['shorturl']=$this->bitly->shorten('http://www.myfavesite.com');

In my view I put:
Code:
<?php echo($shorturl) ?>

and all I get is blank output. Nothing below the php statement is output.

I'm on a windows server if that matters.
#4

[eluser]CIfan[/eluser]
[quote author="ImmergeTech" date="1271114462"]I've put bitly.php into application/config
I've put Bitly.php into application/libraries


I put my API key and username into the bitly.php config file.

In my controller I put:
Code:
$this->load->library('bitly');
$data['shorturl']=$this->bitly->shorten('http://www.myfavesite.com');

In my view I put:
Code:
<?php echo($shorturl) ?>

and all I get is blank output. Nothing below the php statement is output.

I'm on a windows server if that matters.[/quote]
Is CURL activated on your server?
#5

[eluser]ImmergeTech[/eluser]
After seeing your post I enabled the PHP curl extension and restarted Apache2. Still have the same problem.

Curl is working on my server, I used this to test it:
Code:
<?php
    var_dump(curl_version());
?>

and it outputs a bunch of stuff.
#6

[eluser]CIfan[/eluser]
[quote author="ImmergeTech" date="1271117456"]After seeing your post I enabled the PHP curl extension and restarted Apache2. Still have the same problem.

Curl is working on my server, I used this to test it:
Code:
<?php
    var_dump(curl_version());
?>

and it outputs a bunch of stuff.[/quote]
What happens if you do this?
Code:
if ($result = $this->bitly->shorten('http://www.example.com'))
{
    echo $result;
    exit();
}
#7

[eluser]ImmergeTech[/eluser]
Thanks, that solved the problem.
#8

[eluser]plasticated[/eluser]
Fantastic! Thank you Smile
#9

[eluser]patrickpopowicz[/eluser]
The library has been converted to a spark, you can get it over at http://getsparks.org/packages/codeigniter-bitly/show.




Theme © iAndrew 2016 - Forum software by © MyBB