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&[email protected]&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
https://forums.phpfreaks.com/topic/223877-fopen-and-fread-trouble/
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://[email protected]&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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.