2011-07-19 60 views
0

我有一個test.php文件,將持有一個Facebook應用程序(基於iframe的PHP)。如何使用curl從php文件中檢索數據?

我也有一個dev environement所有我的文件去之前,他們承諾live

我想要做的是創造live服務器,將被Facebook可以看到一個curl pagecurl page會從我的test.php頁面上dev

坐在我一直在努力,但我得到拉數據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_content ; 

有關如何完成該任何想法?

謝謝

回答

0

你真的需要捲曲嗎?

直播:

<?php readfile('http://your.dev.server.example.com/test.php');?> 
+0

不幸的是。捲曲是我需要使用的。謝謝你的提示 – Patrioticcow