Solved

XMLHTTP Cross-domain not works in Firefox 3

Posted on 2008-09-29
3
417 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php subtract from date 2 27
deprecated mysql extensions 1 23
Get data from two MySQL tables 6 21
AJAx/JQuery/JSON Error 3 9
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

740 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