views:

126

answers:

4

File I'm trying to save is from this url;

http://m.assetbar.com/achewood/autaux?b=M%5ea11f09b8576e606bcb5038dfdb92fb821&u=http%3A%2F%2Fachewood.com%2Fcomic.php%3Fdate%3D09102010

This does not work (only with this url): file_get_contents($string)

But this works just fine: file_get_contents('http://m.assetbar.com/achewood/autaux?b=M%5ea11f09b8576e606bcb5038dfdb92fb821&u=http%3A%2F%2Fachewood.com%2Fcomic.php%3Fdate%3D09102010')

I've even tried to use quotes thinking it might help, no luck.

A: 

Well i made a webcrawler using file_get_content and when i add $string as parameter for this function it works just fine!

Maybe you don't have a value for $string.

$string = 'http://achewood.com/comic.php?date=' .date('dmy');

get_file_content($string);

Jordy
Why? It's a image? Edit: I See, update image everyday.
Jordy
Look @ my edit from my answer,
Jordy
It's also a rare URL to get the content from, if you have a moment maybe i can figure it out 4 u
Jordy
@ Jordy, it is unique url that why its not working for me. Because it works perfectly fine with other urls.
emcgfx
When opening gif file this is the message I get > GIF image was truncated or incomplete.
emcgfx
Edited post, see above.
emcgfx
Why do you want the content of it exactly
Jordy
Yes it works fine when you use the $string, but it does not save it properly to the file :-)
emcgfx
@ Jordy, just something I'm working on ;)
emcgfx
It's ok no big deal guys, will figure it out.
emcgfx
http://achewood.com/comic.php?date=09102010
Jordy
$string = 'http://achewood.com/comic.php?date=' .date('dmy');
Jordy
A: 

Assuming your "save function" is called emcgfx_save_file() ...

<?php
    $file = file_get_contents('http://domain.com/file?b=M%5ea11239b8576126bcb5038dfdb92fasf21&amp;u=http%3A%2F%2Fdomain.com%2Ffile.php%3Fdate%3D09102010');
    emcgfx_save_file( $file );

is functionally identical to

<?php
    $string = 'http://domain.com/file?b=M%5ea11239b8576126bcb5038dfdb92fasf21&amp;u=http%3A%2F%2Fdomain.com%2Ffile.php%3Fdate%3D09102010';
    $file = file_get_contents($string);
    unset( $string );
    emcgfx_save_file( $file );

If one works, and the other does not, then there's something strange going on. If you try this, and it doesn't solve your problem, try to give us some more info -- for example, when it "doesn't work" what error are you receiving?

Lee
A: 
$string = 'http://achewood.com/comic.php?date=' .date('dmy');
Jordy
A: 

Thank you guys.

emcgfx