1/19/2006

Unsetteled : cross domain problem & PHP on sf

till now still can't solve the cross-domain problem.

In short. now I am making my web page, which will load the pages from an other domain. Thus I get the cross domain problem. that is, the domain of my page is , e.g. xxx.sf.net, and that of the loaded page is www.a.com. Then they can not operate eachother by scripting DOM models. For the security reason.
It's a severe problem faced by AJAX too.

Since I put my demo on sf.net, and sf.net support the server side code of PHP/CGI. I first tried to make a PHP proxy, which will receive the HTTP request to the other domains, then crawl, modify and redirect the content back to the user. Thus, all the pages will come from the same domain: sf.net

But still failed. My php just doesn't work.
if I use :
" $file_contents = file_get_contents('http://example.com/');// display fileecho
$file_contents;
?>"
I get the "permission dedined " warning message.

then I tried the


"
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, 'http://example.com');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
// display file
echo $file_contents;
?>

"
as given by http://wiki.dreamhost.com/index.php/CURL.
No warning or error appears, just a blank page. :-(

sign... never touched PHP before.....
too many possiblities, from the PHP, the sf server... etc.
Hope tommorrow will have some progress.



2 comments:

Anonymous said...

you can not solve the cross dressing problem.

What? Cross domain problem?

Never mind.

midi said...

hi, emily litella,
Thank you for your comment! u know I have gpt no response for decades! &_&