Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts

    Get URL from another domain (Cross-domain)

    Good day!

    I'm aware of the "Same Origin Policy" for JS, which I explained to my client about the "impossibility" of what he's asking.

    I've read about AJAX cross domain: http://www.ajax-cross-domain.com/
    ...and haven't recieved any response about their service (yet).

    Anyway, I was thinking of something like this:

    1. Submit data on another domain (generate.php) via get method.
    2. generate.php processes the form data and passed strings unto URL.
    3. Can we get the url created from the no.1 scenario?

    The main issue is this: I have a form, and when user submits data, it's send to a different domain via get method, and the page is redirected to that "action" field.

    My client (being picky enough) wants to show a "Thank you" page, while the data is being submitted a different page.

    Alternatively, if there's a way to get the URL of the "action" page without even directing to that page then I'll be fine.

    Please guide. If you need further details, please let me know.

    Best Regards,
    Last edited by rangana; 10-31-2008 at 06:51 AM.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Create a proxy in your php which you post to your server and it gets redirected to the other.

    Or submit the form to a hidden iframe and chaneg the content of the current page.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • Users who have thanked A1ien51 for this post:

    rangana (10-30-2008)

  • #3
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Thank you for taking time, I'm uncertain what you meant by the first option provided. Please continue guiding.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #4
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    I'll just mark this as Resolved since I'm trying to isolate the problem in a simplier manner, and that is by 2nd option you've provided.

    ...but no cigar as of now.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #5
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,373
    Thanks
    11
    Thanked 592 Times in 572 Posts
    you can submit (GET) to any domain using an image ping.
    no need for proxying or server-side code for that...

    you could also use a remote script adder script, there's lot of them floating about.

    generate the querystring by looping through the form elements and building it manually by name and value.

    replace the submit button with a <button> that sends the query, and transfers the user after a short delay.
    Last edited by rnd me; 10-31-2008 at 09:02 AM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • Users who have thanked rnd me for this post:

    rangana (10-31-2008)

  • #6
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Hi rnd me, thank you for the response. It's much appreciated.

    I don't think I understand you about the image ping and remote script adder script. Could you by change provide a link for me.

    Quote Originally Posted by rnd me View Post
    generate the querystring by looping through the form elements and building it manually by name and value.

    replace the submit button with a <button> that sends the query, and transfers the user after a short delay.
    I could not do that. I'm bound to submit the form on another domain, and the only thing that's important is the generated URL.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #7
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    Why so long winded Cross Domain is easy with php and AJAX
    Have a page called get.php
    PHP Code:
    SUDO CODE
    Use a $_GET['Address'];
    fopen it read it all in with while note feof()
    then echo it out 
    Then get your AJAX to Read get.php?Address='The page you want to read'
    Its that easy to get AJAX Cross Domain
    You could even do post data via it if you wanted to but i am working on a full solution
    For this

  • Users who have thanked barkermn01 for this post:

    rangana (10-31-2008)

  • #8
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Hi barkermn01,

    Thank you, but I don't think I find ACD simple as you do.

    I tried to get the URL via (AJAX) open method of the httprequest object, but it won't, since it's under another domain.

    Do you have a link to show?
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #9
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    I can build it for you give me 10/20 mins

    Sorry i don't use ACD i hate it for these Reasons
    1. Its far to big
    2. Its a waste of time when a little php or ASP or any other language can do it in a few lines Look Below for php
    3. Takes to long to load a web page using it
    4. Can't use with Tab'ed browser as it fill allotted memory in no time
    5. is Massive
    Last edited by barkermn01; 10-31-2008 at 01:08 PM. Reason: Stating a Point

  • #10
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    get.php
    PHP Code:
    <?php
    $address 
    $_GET['address'];
    $fh fopen($address,'rb');
    $output '';
    while(!
    feof($fh)){
        
    $output .= fread($fh,4068);
    }
    echo 
    $output;
    ?>
    Then just get your AJAXGHandle.open("GET",'get.php?address='+address,true);
    where var address is == your remote IP

    This is the Script working http://barkersmedia.co.uk/get.php?ad...w.google.co.uk

    So then you can use the AJAX to use the get.php
    Last edited by barkermn01; 10-31-2008 at 12:29 PM.

  • Users who have thanked barkermn01 for this post:

    rangana (11-01-2008)

  • #11
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    That's quiet interesting, but that's all serverside and does'nt check for the generated URL on form's submission.

    You can test out my dilemma here at: yourcashforgold.com/1

    Sign on the form and you'll be redirected on another domain. What's important is the trackID generated by that domain. Do you have any other insight on how could I be able to get the URL generated?
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #12
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    Hay, add me to MSN, i will pm u with email address

    And we can talk about what you want todo and how you want it to work im sure there will be away to send data to, like i said i am building a class for this.

    So i could help you


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •