?
Solved

XMLHTTP Cross-domain not works in Firefox 3

Posted on 2008-09-29
3
Medium Priority
?
428 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 22599213
>> 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
ID: 22621717
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
ID: 22629094
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
This article discusses how to create an extensible mechanism for linked drop downs.
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 count occurrences of each item in an array.
Suggested Courses

801 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