# Having trouble create a .php file with PHP

**URL:** <https://forum.kirupa.com/t/having-trouble-create-a-php-file-with-php/198026>\
**Category:** programming\
**Created:** [August 21, 2006, 9:42pm UTC](https://forum.kirupa.com/t/having-trouble-create-a-php-file-with-php/198026 "2006-08-21T21:42:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sigepmest37](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@sigepmest37](https://forum.kirupa.com/u/sigepmest37)\
**Post date:** [August 21, 2006, 9:42pm UTC](https://forum.kirupa.com/t/having-trouble-create-a-php-file-with-php/198026/1 "2006-08-21T21:42:19Z")

</div>

I am trying to create a .php file in a specific directory using fopen() and fwrite(). Here is what I have:

```php
$ourFileName = $url ."/index.php";
$fh = fopen($ourFileName, 'w') or die("can't open file");
$stringData="<?
$fuse=$_GET['fuse'];
if($fuse==\"\"){
?>
<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 7;
var plugin = (navigator.mimeTypes && navigator.mimeTypes[\"application/x-shockwave-flash\"]) ? navigator.mimeTypes[\"application/x-shockwave-flash\"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins[\"Shockwave Flash\"].description.split(\" \");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words*)))
continue;
var MM_PluginVersion = words*; 
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf(\"MSIE\")>=0 
&& (navigator.appVersion.indexOf(\"Win\") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> 
'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next 
');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & MM_contentVersion)))
');
document.write('</SCR' + 'IPT\> 
');
}
if ( MM_FlashCanPlay ) {
window.location.replace(\"index.php?fuse=flash\");
} else{
window.location.replace(\"index.php?fuse=html\");
}
//-->
</SCRIPT>
<?
}else{
header(\"Location: https://www.oclawyerstitle.com/rep.php?id=". $id ."&fuse=$fuse\");
}
?>";
fwrite($fh, $stringData);
fclose($fh);

```

The variable “id” is the only thing dynamic, and it is defined before all this.

When I run this I get this error:

**Parse error** : syntax error, unexpected T\_ENCAPSED\_AND\_WHITESPACE, expecting T\_STRING or T\_VARIABLE or T\_NUM\_STRING in **/home/.hefner/landam2/oclawyerstitle.com/input.php** on line **60**

**Line 60 = "** $fuse=$\_GET[‘fuse’];"

Thank you for your help in advance. :trout:
