PHP Classes

getXmlCodeViaCurl

Recommend this page to a friend!

      YouTube API  >  All threads  >  getXmlCodeViaCurl  >  (Un) Subscribe thread alerts  
Subject:getXmlCodeViaCurl
Summary:Add Function getXmlCodeViaCurl for this class
Messages:2
Author:Ruben Crespo
Date:2009-05-28 11:29:09
Update:2009-05-28 11:45:41
 

 


  1. getXmlCodeViaCurl   Reply   Report abuse  
Picture of Ruben Crespo Ruben Crespo - 2009-05-28 11:29:09
Hi !!

Great Class man !!

i´ve found this class very useful for one project in which i am working right now.

But I had a little problem when I discover that the URL File-access was Disabled In The client´s Server Configuration.

The solution was to use Curl to get the Youtube´s API XML code

I think that could be useful add this function to your class.

---
in the __construct () function add the line:
$this->feedString=$this->getXmlCodeViaCurl($url);

and now the new function

private function getXmlCodeViaCurl($url){
//init var $returnStr;
$returnStr="";

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);

$returnStr = curl_exec($curl);

curl_close($curl);

return $returnStr;

}

  2. Re: getXmlCodeViaCurl   Reply   Report abuse  
Picture of Er. Rochak Chauhan Er. Rochak Chauhan - 2009-05-28 11:45:41 - In reply to message 1 from Ruben Crespo
Thanks Ruben.
Your point is duly noted and I have added two new methods:

1) getHtmlCodeViaCurl($url)
2) getHtmlCodeViaWget($url)


Thanks for your feedback.

 
For more information send a message to info at phpclasses dot org.