0

I have a PHP script that basically tries to convert the string it gets from:

https://camwijs.nl/system/avatarimage.aspx?username=

to

https://www.habbo.com/habbo-imaging/avatarimage?figure=

If I run the code it just gives me an page with the error message:

Warning: file_get_contents(https//camwijs.nl/system/avatarimage.aspx?username=nomakta): failed to open stream: No such file or directory in /home/u750368594/public_html/v1/avatar/avatar.php on line 4 http://www.habbo.com/habbo-imaging/avatarimage?figure=

Here is the code:

<?php 
// gets avatar with GR
$camwijsAvatarurl = "https//camwijs.nl/system/avatarimage.aspx?username=".htmlspecialchars($_GET["name"]);
// displays avatar link here
 echo 'http://www.habbo.com/habbo-imaging/avatarimage?fgure=' .file_get_contents($camwijsAvatarurl);

?>
nomakta
  • 13
  • 6

1 Answers1

2

You have an extra trailing . at the end of line 2, which throws a syntax error for improper concatenation:

Parse error: syntax error, unexpected ';' in ... on line 2

Either remove that . or add " " (but only if you're planning on concatenating further)

Tim Lewis
  • 27,813
  • 13
  • 73
  • 102
  • Yes, this would fix that syntax error, but not the specific error that was put in the OP. Maybe the OP has another issue in there (just not represented properly) – Devon Bessemer Apr 29 '15 at 20:42
  • @Devon I'm inclined to agree. That error message implies that something above this line (or in an include?) is incorrect, probably missing a `;` or closing brace, something trailing, etc. – Tim Lewis Apr 29 '15 at 20:44
  • I fixed this error but now I have this error? Warning: file_get_contents(https//camwijs.nl/system/avatarimage.aspx?username=nomakta): failed to open stream: No such file or directory in /home/u750368594/public_html/v1/avatar/avatar.php on line 4 http://www.habbo.com/habbo-imaging/avatarimage?figure= – nomakta Apr 29 '15 at 20:46
  • `Failed to open stream` is synonymous for `I can't find that`. You're missing `:` in `https//...` which may or may not be it. Double check your URL and make sure you can access it correctly. – Tim Lewis Apr 29 '15 at 20:50
  • That was an looking mistake But I'm now getting an HTTP REQUEST FAILED? >Warning: file_get_contents(http://camwijs.nl/system/avatarimage.aspx?username=nomakta): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /home/u750368594/public_html/v1/avatar/avatar.php on line 5 http://habbo.com/habbo-imaging/avatarimage?fgure= – nomakta Apr 29 '15 at 20:54
  • Ok, that means you don't have permission to access that page, as it's an `https`, **s** meaning secure. I don't know if I'll be able to help you with that one... – Tim Lewis Apr 29 '15 at 20:56
  • Just found out why this ISN'T possible. The owner of the website has cloudflare. He told me he was working on a version that directly makes the avatar. Thanks for the help anyways really appriciated – nomakta Apr 29 '15 at 21:21