1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice
  2. If you update to Joomla 3.9.16, you will have to update Fabrik from the latest GitHub version, to fix a bug introduced in Joomla, which makes it impossible to list front end folder locations in backend JForms. This affects things like template selection.
    Dismiss Notice

bitly API used by Fabrik is becoming deprecated

Discussion in 'Community' started by ontarget, Feb 7, 2020.

  1. ontarget

    ontarget Active Member

    Level: Community
    Hi I use Fabrik to generate bitly links, bitly informed me that the API currently used by fabrik is becoming deprecated in March 2020 and will need to use V4

    Is there plans to update the bitly plugin please?
     
    juuser likes this.
  2. mahmoodee

    mahmoodee Member

    Level: Community
    I hope that there is a plan in future for Fabric to update the API and libraries that have been deprecated like "bitly api" , "input mask library" and "PHPExcel library"
     
  3. ontarget

    ontarget Active Member

    Level: Community
    Hi Fabrik team,
    If there are no plans to update the bitly API please let me know either way as i will have to think of an alternative for my system and this could take me 2 weeks.
    Do i need to take out a sub for the update?
    Thanks
     
  4. ontarget

    ontarget Active Member

    Level: Community
    I am posting my code which i used to bitlyfy a url generated from a fabrik form.
    All the elements are encoded into the url and then bitlyfied.
    I am using a calc element and the bitly library from /components/com_fabrik/libs/bitly/bitly.php
    As you can see the use of bitly is very important as the $fullUrl generated is about 3km long! so I would dearly like a response from Fabrik on any plans to update the bitly API or if there is another solution I could use for URL shortening?

    PHP:
    $db = JFactory::getDBO();
    $tr_table = $db->quoteName('aaa_edcentres');
    $eircode = $db->quoteName('eircode');
    $ec = '{___venue_education_centre}';
    if ($ec == "OTHER") {
      $ecName = '{___venue_other}';
      $ecEircode = '{___venue_other_eircode}';
    } else {
      $ecName = '{___venue_education_centre}';
      $query = "SELECT $eircode FROM $tr_table WHERE `edcentre_title` = \"$ec\"";
      $db->setQuery($query);
      $ecEircode = $db->loadResult();
    }



    $fullUrl = 'http://xxxxx.eu/index.php?option=com_fabrik&view=form&formid=1' .
    '&aaa_participant_claim___uniqueclaim_id='. urlencode('{___course_id}') .
    '&aaa_participant_claim___category=' . urlencode('{___category_raw}') .
    '&aaa_participant_claim___course_title=' . urlencode('{___course_title}') .
    '&aaa_participant_claim___course_code=' . urlencode('{___enter_course_code}') .
    '&aaa_participant_claim___applysess=' . urlencode('{___apply_sess}') .
    '&aaa_participant_claim___allow_overnight=' . urlencode('{___allow_overnight}') .
    '&aaa_participant_claim___venue=' . urlencode($ecName).
    '&aaa_participant_claim___course_start_date=' . urlencode('{___enter_course_date}') .
    '&aaa_participant_claim___claim_process=' . urlencode('{___edcentre_email}') .
    '&aaa_participant_claim___edcentre_id=' . urlencode('{___edcentreid}') .
    '&aaa_participant_claim___edcentre_process=' . urlencode('{___education_centre}').
    '&aaa_participant_claim___venue_ec=' . urlencode($ecEircode);

    require_once JPATH_SITE . '/components/com_fabrik/libs/bitly/bitly.php';
             $bitly = new bitly('xxxxmyUsername', 'xxxmyAPIkeyxxxx');
           
                 
              // bitlify it
             $url = (string) $bitly->shorten($fullUrl);
           
             return $url;
     
  5. mahmoodee

    mahmoodee Member

    Level: Community
    please I need that too for my current project too
     
  6. ontarget

    ontarget Active Member

    Level: Community
    If there are no plans by Fabrik to upgrade to bitly v4 then yourls can be used
    https://github.com/YOURLS/YOURLS/releases
    I used a calc element then used the yourls api call to shorten my link - works just grand!
    PHP:

    $username = 'xxxxx';
    $password = 'xxxxx';

    // EDIT THIS: the query parameters
    $url     = 'http://xxxxx/index.php?option=com_fabrik&view=form&formid=1' .
    '&aaa_participant_claim___uniqueclaim_id='. urlencode('{___course_id}') .
    '&aaa_participant_claim___category=' . urlencode('{___category_raw}') .
    '&aaa_participant_claim___course_title=' . urlencode('{___course_title}') .
    '&aaa_participant_claim___course_code=' . urlencode('{___enter_course_code}') .
    '&aaa_participant_claim___applysess=' . urlencode('{___apply_sess}') .
    '&aaa_participant_claim___allow_overnight=' . urlencode('{___allow_overnight}') .
    '&aaa_participant_claim___venue=' . urlencode($ecName).
    '&aaa_participant_claim___course_start_date=' . urlencode('{___enter_course_date}') .
    '&aaa_participant_claim___claim_process=' . urlencode('{___edcentre_email}') .
    '&aaa_participant_claim___edcentre_id=' . urlencode('{___edcentreid}') .
    '&aaa_participant_claim___edcentre_process=' . urlencode('{___education_centre}').
    '&aaa_participant_claim___venue_ec=' . urlencode($ecEircode);  // URL to shrink

    $format  = 'simple';                       // output format: 'json', 'xml' or 'simple'

    // EDIT THIS: the URL of the API file
    $api_url = 'http://xxxxxx/yourls/yourls-api.php';

    // Init the CURL session
    $ch = curl_init();
    curl_setopt( $ch, CURLOPT_URL, $api_url );
    curl_setopt( $ch, CURLOPT_HEADER, 0 );            // No header in the result
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); // Return, do not echo result
    curl_setopt( $ch, CURLOPT_POST, 1 );              // This is a POST request
    curl_setopt( $ch, CURLOPT_POSTFIELDS, array(      // Data to POST
          'url'      => $url,
            'keyword'  => $keyword,
            'title'    => $title,
            'format'   => $format,
            'action'   => 'shorturl',
            'username' => $username,
            'password' => $password
        ) );

    // Fetch and return content
    $data = curl_exec($ch);
    curl_close($ch);

    // return the result - either ajax calc or on save.
    return $data;
     
  7. mediaateam

    mediaateam Super Moderator Staff Member

    Level: Community
    It will need to be a funded project, so if anyone is interested in funding the development, pm me. We will take a look and get an estimate on what it will take. Thanks!
     
  8. mahmoodee

    mahmoodee Member

    Level: Community

Share This Page