file_get_contents workaround
Posted by: Johnny Lode
Posted on: 2007-06-18 16:35:00
Ok here goes. I have a php script that I am trying to use that will scrape the "comments" section of a myspace, then I have a flash embedded on my myspace profile page that is supposed to use the php and display the comments into the flash. The problem I am having is that the php file has:
In reply to:
"$myspace = file_get_contents("http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=$friendid");"
on one of the lines. From what I have read in the DH wiki is that file_get_contents is blocked and the code needs to be reworked. I tried updating the code to this:
In reply to:
#testing file_get work around
$site_url = 'http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=$friendid';
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $site_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
ob_start();
curl_exec($ch);
curl_close($ch);
$myspace = ob_get_contents();
ob_end_clean()
But to no avail. I am very new at php so I am kind of stuck as to where to go. If anyone has any ideas it would be appreciated or if I can be pointed it would be helpful. I uploaded a copy of the original php script as a .txt file here:
http://www.redcrabgang.com/myspace/flash_comments.txt
Also the original tutorial for the project is here:
http://forum.myspace.com/index.cfm?fuseaction=messageboard.viewThread&groupID=105716338&page=0&EntryID=33978304&CategoryID=0&get=1&adTopicId=1&lastpagesent=4
Thanks for any help!