i have a test.php
file that will hold a facebook app (iframe based php).
I also have a dev environement
where all my files go before they are commited to live
.
What i want to do is create a curl page
on the live
server that will be seen by facebook and that curl page
will pull the data from my test.php
page that sits on the dev
i have been trying but i get Authorization Required
:
/* gets the data from a URL */
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$returned_content = get_data('http://dev.xxx.com/test.php');
echo $returned_cont开发者_开发问答ent ;
any ideas on how to accomplish that?
Thanks
Okay, that is specific error. If you need facebook authorization, you must look at Facebook API for authorization methods. If you are getting HTTP authorization error, you may use apropriate CURL options: http://www.php.net/manual/en/function.curl-setopt.php
Do you really need curl?
Live:
<?php readfile('http://your.dev.server.example.com/test.php');?>
Try using the file_get_contents function
精彩评论