Solved

XMLHTTP Cross-domain not works in Firefox 3

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

785 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