Jump to content

fopen and fread trouble


gotornot

Recommended Posts

Hi

 

i am trying to read a page that i open but i keep getting errors and dont know why any ideas.

 

The code im using is:

	foreach($url_extq_data as $a)
	{
	$var .=$a;
	}
// now replace all the tags in the substring and out put the data
$from = array("{our_track}", "{name}", "{surname}", "{email}", "{title}", "{gender}", "{dobday}", "{dobmonth}", "{dobyear}", "{address}", "{address2}", "{town}", "{county}", "{postcode}", "{tel}", "{mobile}", "{timestampu}", "{timestampr}", "{username}", "{password}", "{company}", "{siteurl}", "{fax}", "{tracking}");
$to = array("$our_id", "$name", "$surname", "$email", "$title", "$gender", "$dobday", "$dobmonth", "$dobyear", "$address", "$address2", "$town", "$county", "$postcode", "$tel", "$mobile", "$timestampu", "$timestampr", "$username", "$password", "$company", "$siteurl", "$fax", "$trackit");
$final_url = str_replace($from, $to, $var);
// open url and wait for response
$handle = fopen('$final_url', "r");
echo $final_url;
##$contents2 = stream_get_contents($handle);
$contents2 = '';
$contents2 .= fread($handle, 100);
$contents2 = trim($contents2);

 

This is what i get back:

 

<br /> <b>Warning</b>: fopen($final_url) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in <b>/home/s/e/searlco/web/public_html/ms_creg.php</b> on line <b>232</b><br /> http://www.cleanleads.co.uk/lead.aspx?campid=30&suppid=284&HSID=1121&HOID=52&FirstName=Dafydd&LastName=Thomas&AddressLine1=31 Cottage Street&Postcode=SS131HR&Gender=M&DateOfBirth=13/10/1980&emailaddress=dait@tedfsdfsdit.com&title=Mr&SupplierSourceCode=11866<br /> <b>Warning</b>: fread(): supplied argument is not a valid stream resource in <b>/home/s/e/searlco/web/public_html/ms_creg.php</b> on line <b>236</b><br /> ER

 

Any help anyone???? im lost

Link to comment
Share on other sites

hi

 

Ive just tried that so this code now:

 

	foreach($url_extq_data as $a)
	{
	$var .=$a;
	}
// now replace all the tags in the substring and out put the data
$from = array("{our_track}", "{name}", "{surname}", "{email}", "{title}", "{gender}", "{dobday}", "{dobmonth}", "{dobyear}", "{address}", "{address2}", "{town}", "{county}", "{postcode}", "{tel}", "{mobile}", "{timestampu}", "{timestampr}", "{username}", "{password}", "{company}", "{siteurl}", "{fax}", "{tracking}");
$to = array("$our_id", "$name", "$surname", "$email", "$title", "$gender", "$dobday", "$dobmonth", "$dobyear", "$address", "$address2", "$town", "$county", "$postcode", "$tel", "$mobile", "$timestampu", "$timestampr", "$username", "$password", "$company", "$siteurl", "$fax", "$trackit");
$final_url = str_replace($from, $to, $var);
// open url and wait for response
$handle = fopen($final_url, "r");
//echo $final_url;
##$contents2 = stream_get_contents($handle);
$contents2 = fread($handle, 100);
$contents2 = trim($contents2);

 

this is the response :(

 

<br /> <b>Warning</b>: fopen(http://...@5656f5ple.com&title=Mr&SupplierSourceCode=11871) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in <b>/home/s/e/searlco/web/public_html/ms_creg.php</b> on line <b>232</b><br /> <br /> <b>Warning</b>: fread(): supplied argument is not a valid stream resource in <b>/home/s/e/searlco/web/public_html/ms_creg.php</b> on line <b>235</b><br /> ER

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.