Thread: cURL
View Single Post
Old 2006-10-03, 07:59 AM   #2
kitty_kate
Well you know boys, a nuclear reactor is a lot like women. You just have to read the manual and press the right button
 
kitty_kate's Avatar
 
Join Date: Jun 2006
Location: The Colloseum
Posts: 155
Send a message via ICQ to kitty_kate
In your script, I see at the line number 36 this:
PHP Code:
$xml_content file_get_contents$xml_source 
Here is where you have to make the change.

Add this function to your script, at the beggining of it, right after the <?php tag line:

PHP Code:
/**
  * Retrieves the url
  *
  * @param string $url
  * @param string $uagent
  * @return string
  */
 
function retrieveUrl($url) {
     
// create a new CURL resource
     
$ch curl_init();
     
// set URL and other appropriate options
     
curl_setopt($chCURLOPT_URL$url);
     
curl_setopt($chCURLOPT_HEADERtrue);
     
curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
     
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
     
// grab URL and pass it to the browser
     
$result curl_exec($ch);
     
// close CURL resource, and free up system resources
     
curl_close($ch);     
     return 
$result;
 } 
Then change your code at the 36th line into:
PHP Code:
$xml_content retrieveUrl$xml_source 
I didn't tested it 'cause I'm on the run, but it should work.
__________________
My Asian Kitty - My Free Sites
kitty_kate is offline   Reply With Quote