Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4622140
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:48:06+00:00 2026-05-22T02:48:06+00:00

<html> <head> <script type=text/javascript src=jquery-1.6.1.js></script> <script> $(‘a’).click(function(e) { e.preventDefault(); document.location.href=’http://www.redirectlink.com?ref=’+this.href; return false; }); </script>

  • 0
<html>
  <head>
    <script type="text/javascript" src="jquery-1.6.1.js"></script>
    <script>
      $('a').click(function(e) {
        e.preventDefault();
        document.location.href='http://www.redirectlink.com?ref='+this.href;
        return false;
      });
    </script>
</head>

<?php          
  $ch = curl_init();
  curl_setopt ($ch, CURLOPT_URL, 'http://192.168.0.14:8081/home/');
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  $curl_response = curl_exec($ch);
  curl_close($ch);

  echo $curl_response;     
?>

Should this be working? It curls a page and then when you click on a link on the page it should redirect to http://www.redirectlink.com?ref=‘+this.href The curling part works but it doesn’t redirect. It still takes me to the original url. The jquery-1.6.1.js file is in the same directory as all the other files.

EDIT: Problem fixed. Needed to ready the javascript.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:48:07+00:00Added an answer on May 22, 2026 at 2:48 am

    Redirect?

    Four issues:

    1). You’re calling the $(‘a’) selector before the document has loaded. You won’t get any A’s. You’ll need to wrap this in document.ready or something similar.

    $(document).ready(function(){
      //put your script block here.
    });
    

    2). You need to encodeUriComponent on this.href.

    3). You seem to be assuming it is a fully-qualified URL, never a relative URL.

    4). If what you’re lookng for is a redirect, you’ll need to just use a redirect header (CURL isn’t necessary):

    if (array_key_exists('ref', $_GET))
    {
      header('Location: '.$_GET['ref']);
      exit;
    }
    

    Note — this must go ABOVE any output… basically, move your php block to the very top of the file.


    Clarification. Not a redirector at all:

    if (array_key_exists('ref', $_GET))
    {
       echo file_get_contents($_GET['ref'];
    }
    

    The above block replaces all of your PHP code in 3 easy-to-understand lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following file file: <html> <head> <title></title> <script type=text/javascript src=/Prototype.js></script> <script type=text/javascript>
For example: script.js: function functionFromScriptJS() { alert('inside functionFromScriptJS'); } iframe.html: <html> <head> <script language=Javascript
I am using this HTML <html> <head> <Title>EBAY Search</title> </head> <script language=JavaScript src=ajaxlib.js></script> <body>
I have a code like this. <html> <head> <title>Captcha With Refresh Feature</title> <script src=jquery.js
Code: <html xmlns=http://www.w3.org/1999/xhtml> <head> <title>Unusual Array Lengths!</title> <script type=text/javascript> var arrayList = new Array();
I am using the following html page: <html> <head> <title>AJAX Example</title> <meta http-equiv=Content-Type content=text/html;
Code and preview: <html> <head> <title>Testing some CSS</title> <style type=text/css> .dDay { font-size:205% }
<html> <head> <style type=text/css> div { border:1px solid #000; min-width: 50%; } </style> </head>
I have the following code <html> <head> <title>Test</title> <style type=text/css> <!-- body,td,th { color:
I'm attempting to select all <script type=text/html> tags in a page. I use <script>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.