3 Replies - 2599 Views - Last Post: 29 January 2015 - 07:02 AM Rate Topic: ***** 1 Votes

#1 Tobacco_Road   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-January 15

Parse error: syntax error, unexpected 'http' (T_STRING)

Posted 29 January 2015 - 01:28 AM

I've created a new php file from 'filename' on my server through a form request and now I want it so the processing page inserts the require tags when creating the php files.

Parse error: syntax error, unexpected 'http' (T_STRING)

$filename = ($_POST['filename']) . ".php";

$field = ' '
.'<?php'
.'require 'http://somesite.php';'
.'require 'http://somesite.php';'
.'require 'http://somesite.php';'
.'require 'http://somesite.php';'
.'require 'http://somesite.php';'
.'require 'http://somesite.php';'
.'require 'http://somesite.php';'
.'require 'http://somesite.php';'
.'require 'http://somesite.php';'
.'?>';

  $data = fopen($filename,'w');
    fwrite($data,$field);
    fclose($data);


Is This A Good Question/Topic? 0
  • +

Replies To: Parse error: syntax error, unexpected 'http' (T_STRING)

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4278
  • View blog
  • Posts: 13,571
  • Joined: 08-June 10

Re: Parse error: syntax error, unexpected 'http' (T_STRING)

Posted 29 January 2015 - 01:38 AM

you see the syntax highlighting in the code snippet?
Was This Post Helpful? 0
  • +
  • -

#3 Tobacco_Road   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-January 15

Re: Parse error: syntax error, unexpected 'http' (T_STRING)

Posted 29 January 2015 - 01:47 AM

View PostDormilich, on 29 January 2015 - 01:38 AM, said:

you see the syntax highlighting in the code snippet?



How to I do this properly to hold it in the variable correctly so that no errors show up and it will process through to the newly created file?
Was This Post Helpful? 0
  • +
  • -

#4 CTphpnwb   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,997
  • Joined: 08-August 08

Re: Parse error: syntax error, unexpected 'http' (T_STRING)

Posted 29 January 2015 - 07:02 AM

Dot notation is used to concatenate strings, but you've got one long string, so why use it? Also, if you want to use quotes within quotes you need to escape the inner quotes or use different quotes for inner and outer, i.e., $example = 'This "would" work';
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1