Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

URL Forwarding with API


  • Please log in to reply
11 replies to this topic

#1 rajjaak24

rajjaak24

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:11:36 PM

Posted 17 November 2012 - 09:23 AM

Ok guys I've been trying to figure this out for weeks.

Basically I have an index of sites

which all follow the format of http://xxxxxx.com

what I want to do is make a forwarder that passes through the ADFLY API

like this

http://go.rajjak.com/go?=somewebsite.com

I am yet to figure out a PHP script to firstly:

redirect on the fly so all I have to do is ad http://go.rajjak.com/go?= to a url
which can automatically be added on to the page.

secondly
I've tried just directly linking with the adfly api
but the output you recieve is plain text not clickable I want to remove that so the url is encoded with the API to make an adfly link.

So
http://go.rajjak.com/go?=youtube.com would make http://adf.ly/somerandoomnumbers ALL without end user interaction.

Can anyone help me with this endeavor?

It is possible I've seen it on some websites

Thanks for reading.

BC AdBot (Login to Remove)

 


#2 KamakaZ

KamakaZ

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:10:36 AM

Posted 19 November 2012 - 12:26 AM

Try this - YOURLS

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


#3 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:11:36 PM

Posted 19 November 2012 - 11:16 AM

I've seen that its another URL shortener I don't need. I just need some help on making something that will get the variable (generated adfly link) and insert it into a http redirect.

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:05:36 PM

Posted 19 November 2012 - 01:06 PM

This willl work as long as you have not sent any other data back to the client:
header('Location: NEW PAGE URL');

If that doesn't work, then you just need to load a small snip of code that redirects once loaded to the client machine:
<meta http-equiv="refresh" content="0;url=NEW PAGE URL" />

#5 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:11:36 PM

Posted 19 November 2012 - 04:37 PM

Its almost there BUT this is how its "supposed" to work...
http://website.com/?url=http://bleepingcomputer.com

1.
http://website.com/?url=
contains the API which converts http://bleepingcomputer.com into an adfly link

2.
The API creates a PLAIN TEXT

3.
Some PHP code with the file_get_contents() function gets the plain text

4. It then redirects the user to the new adfly url header("Location: $adflyurl")

This is what I want.

#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:05:36 PM

Posted 19 November 2012 - 05:41 PM

So you are asking how to dynamically build a simple url? What are the contents of get_file_contents? The url?

#7 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:11:36 PM

Posted 19 November 2012 - 06:12 PM

This is what a good friend said

We do use the adf.ly API to do this, you're right in saying it produced a plain text output, but we basically use that as a parameter for our redirection, so in PHP we use file_get_contents() to call the API, then assign that to a variable, that variable will be the new adf.ly link you can use, so then we use header("Location: $adflyurl") to use a HTTP header redirect to the new adf.ly link


Sorry there is a slight language barrier.

Edited by rajjaak24, 19 November 2012 - 06:12 PM.


#8 KamakaZ

KamakaZ

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:10:36 AM

Posted 20 November 2012 - 12:12 AM

I don't understand the purpose of having the URL on the end of the domain name as a parameter, then getting a short URL for the original and then redirecting the user to the shortened one? Why not just redirect them to the original URL?

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


#9 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:05:36 PM

Posted 20 November 2012 - 08:29 AM

Why not just redirect them to the original URL?

Research 'affiliate links' and you will understand.

@rajjaak24, I don't understand the problem. You get the contents of a file, which is a url, and you assign it to a variable. Then you use the variable in the redirect. You may want to ask your friend for help because this is pretty simple. Have you ever used php at all?

#10 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:11:36 PM

Posted 20 November 2012 - 11:12 AM

I've scratched the surface nothing too intense (intense for me is probably basic for you) I'd just like help from someone just to start me off not feed me. My friend isn't available at this moment in time I don't know when he will be back.

#11 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:05:36 PM

Posted 20 November 2012 - 01:26 PM

So you should just need to do something like this:
  $sUrl = file_get_contents(MY URL);
  header('Location: $sUrl');

If you want to see the data held in $sUrl, all you need to do is this:
echo $sUrl;

That should get you started. :)

#12 rajjaak24

rajjaak24
  • Topic Starter

  • Members
  • 46 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:11:36 PM

Posted 20 November 2012 - 01:58 PM

Thank you




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users