Solved

XMLHTTP Cross-domain not works in Firefox 3

Posted on 2008-09-29
3
411 Views
Last Modified: 2012-08-13
I have a code which sends data to 3rd party website using JavaScript XMLHTTP POST and puts output in textbox for user.

It works on IE but in Firefox 3 I get permission denied, it's because I call to 3rd party website, what can I do?

What's solution for it?

Thanks from now!
0
Comment
Question by:CSecurity
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
Comment Utility
>> it's because I call to 3rd party website
Yes

>>what can I do?
create a new page on your server called proxyPage.php and call YOUR proxyPage.php instead of the third party page directly. Assuming you are sending username="Joe" to YOUR proxyPage.php, then your script would be:

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.remotesite.com/script.php');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "username=" . urlencode($_REQUEST['username']) );
$data = curl_exec($ch);
curl_close($ch);

//now send the result back to the ajax call:
echo $data;
exit;
?>
0
 
LVL 17

Author Comment

by:CSecurity
Comment Utility
I did it, I coded everything without checking my server have CURL or no!!

What can I do now? My server doesn't have CURL
0
 
LVL 82

Expert Comment

by:hielo
Comment Utility
find out if you can make outbound calls. If not, you have reached a dead end. Some webhost companies do NOT allow outbound connections.
If you ARE in fact allowed to make outbound connections, see what other alternatives you have ex: is this an IIS server, if so you may be able to use a MSXML2.Server object. If you are in a non-windows environment, then see if they have perl available and seek a perl solution.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now