[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

I keep getting 'Resource id #9' for a value of a variable

Posted on 2011-09-14
1
Medium Priority
?
416 Views
Last Modified: 2012-05-12
Hi,
I understand why I'm getting Resource id #9 as a value (its the allocated memory space I think for the value).. or something like that.

Problem is I can't see why I get that. Here is the pertinent code:

$myurl= $RecordingUrl.".mp3";
   $infile = fopen ($myurl, "r");
   $outfile = fopen ("../../../modules/account/recordings/".$account_id."/test2.mp3","w");
   while (!feof ($infile))
   {
    fwrite($outfile,fread ($infile, 1024));
   }

   fclose($outfile);
   fclose ($infile);





	$email = $stationemail;
	$subject = "Winning Caller Details for ".$campaignname." from ".$stationname;
	$body = "Contest Details for ".$campaignname.":\n\n";
	$body .= "Contest ended: ".date("F j, Y, g:i a")."\n";
	$body .= "Caller phoned in using: ".$CallTo." contest line.\n";
	$body .= "Winning Caller was put through to: ".$djphone.".\n";
	$body .= "Caller's Name: ".$CallerName."\n";
	$body .= "Caller's Phone Number: ".$FromCaller."\n";
	$body .= "Caller's City: ".$CallerCity."\n";
	$body .= "Caller's Province/State: ".$CallerState."\n";
	$body .= "Recording Duration: ".$CallDuration." minutes long.\n\n";
	$body .= "Here is the link to the recording:\n";
	$body .= $outfile;

Open in new window


The script is saving an mp3 from a remote location into a local directory on the server (that works fine, there is a file there)
Next I'm emailing the url to the newly created mp3 on my server. For a value (last line of the code), I keep getting 'Resouce id #9)

How do I get the url to the mp3 file instead of the resource number?

Thanks tj
0
Comment
Question by:tjyoung
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 36538422
you will need something similar to the code below.  The 'Resource id #9' is because of $outfile = fopen();

fopen does NOT return the name of the file - it returns a resource id.
$myurl= $RecordingUrl.".mp3";
$outurl="../../../modules/account/recordings/".$account_id."/test2.mp3";
   $infile = fopen ($myurl, "r");
   $outfile = fopen ($outurl,"w");
   while (!feof ($infile))
   {
    fwrite($outfile,fread ($infile, 1024));
   }

   fclose($outfile);
   fclose ($infile);





	$email = $stationemail;
	$subject = "Winning Caller Details for ".$campaignname." from ".$stationname;
	$body = "Contest Details for ".$campaignname.":\n\n";
	$body .= "Contest ended: ".date("F j, Y, g:i a")."\n";
	$body .= "Caller phoned in using: ".$CallTo." contest line.\n";
	$body .= "Winning Caller was put through to: ".$djphone.".\n";
	$body .= "Caller's Name: ".$CallerName."\n";
	$body .= "Caller's Phone Number: ".$FromCaller."\n";
	$body .= "Caller's City: ".$CallerCity."\n";
	$body .= "Caller's Province/State: ".$CallerState."\n";
	$body .= "Recording Duration: ".$CallDuration." minutes long.\n\n";
	$body .= "Here is the link to the recording:\n";
	$body .= $outurl;

Open in new window

0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
In this article, we’ll look at how to deploy ProxySQL.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question