Uncaught SyntaxError: Unexpected token < für die Liste 1 in php (<?php)

Ich müde über die proxy-Lösung in

Herkunft http://localhost ist nicht erlaubt, Access-Control-Allow-Origin.?

und auf die Datei proxy.php ich habe

<?php
//File Name: proxy.php
if (!isset($_GET['url'])) die();
$url = urldecode($_GET['url']);
$url = 'http://' . str_replace('http://', '', $url); //Avoid accessing the file system
echo file_get_contents($url);

In main habe ich

<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<script src="proxy.php"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-                1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<script type="text/javascript"     src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
$.ajax({
url:"proxy.php?url=theurlofmyapi",
type:'GET',
dataType:"json",
success:function(data){console.log(data.results.result[1].category);}
});</script>
</head>

<body>
<div data-role="header"> 
<h1>Upcoming Movies</h1> 
</div> 
<ul id= "data" data-role="listview">
<li><img src="http://content8.flixster.com/movie/11/17/20/11172082_mob.jpg"         class="ui-li-thumb"><h3 class="ui-li-heading">Warning</h3><p class="ui-li-desc">hot</p>                           </li>
<li><a href="javascript:alert('hi')">Audi</a></li>
<li><a href="bmw.html">BMW</a></li>
</ul></body></html>

Ich rufe jetzt main.html in meinem localhost in Google chrome und auf der Konsole sagt Fehler auf der ersten Zeile der php. Ich bin mir nicht sicher, was das problem ist. Die Fehlermeldung ist:
Uncaught SyntaxError: Unexpected token <

Mögliche Duplikate von: stackoverflow.com/questions/13351478/...
Ich sah den vorherigen Fragen wie diese. Ich denke mir ist es anders, da die Fehler in der ersten Zeile meiner php-code. die<?php ist ein syntax-Fehler? Seine fast wie <?php wird nicht erkannt...
Ich sehe nicht, dass ein Teil in deinem code?
Die erste Zeile in proxy.php die klebte ich wie der erste code-Abschnitt in meine Fragen. Die erste Zeile ist <?php ich denke, die Konsole sagt mir, es nicht erkennt die < Teils
Ihre proxy.php - code als auch.

InformationsquelleAutor tcui222 | 2013-08-31

Schreibe einen Kommentar