Fetching a php file

Is there any reason why any of this would result in endless waiting (status changes to ‘downloading’ and then it just counts time)

tool fetch url=“http://www.some.com/something.hr/mt/update.php?u=1&p=b9fedbb1b5952500c58208097c808db1&d=7&i=0.0.0.0&s=x86&v=ver&t=yyyy-mm-dd hh:mm” mode=http


this results the same
tool fetch address=“www.some.com” src-path=“/something.hr/mt/update.php?u=1&p=b9fedbb1b5952500c58208097c808db1&d=7&i=0.0.0.0&s=x86&v=ver&t=yyyy-mm-dd hh:mm” mode=http


And allso, is there a way to read the file?
The php file enters the information into SQL and if successful, returnd character 1 (or 0 if unsuccessful)
so i can do something if returned 0 or 1?


thanks

I’ve seen cases where if the return data is empty /tool fetch would hang and continue “downloading” for a long time. Just ensure (maybe through a packet capture), that data is in fact being returned from the server.

To read the data returned by the server, set dst-path=. If the return data is < 4095 bytes, you can read it inside RouterOS by using:

/file get <somefile> contents

It used to work but i accidentaly deleted the script 8-(
If i enter the URL in a browser, i get exactly what i need.

when i break the download (after waiting for a long time) i get the error ‘no such item’


could you try fetching this:
/tool fetch address=“www.giganet.hr” src-path=“/avatars/tp-avatar.png” mode=http dst-path=“tp-avatar.png”
I get a 404 error

and since i will delete the record in sql, try this too:
/tool fetch address=“www.giganet.hr” src-path=“/giganet.hr/mt/update.php?u=1&p=b9fedbb1b5952500c58208097c808db1&d=7&i=w.x.y.z&s=x86&v=ver&t=yyyy-mm-dd hh:mm” mode=http dst-path=“phpresult”
this hangs and when interrupted, ‘no such item’ error is returned

In console ? is a special character that prints help.

Put \ before ?

Same thing happens
(in console it no longe prints commands, but from script, the same)

Works fine form console and from script

[admin@dzeltenais_burkaans] /system script> print from=php
Flags: I - invalid 
 0   name="php" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive 
     last-started=oct/11/2010 12:20:56 run-count=1 
     source=/tool fetch address="www.giganet.hr" src-path="/giganet.hr/mt/update.php\?u=1&p=b9fedbb1b59
       52500c58208097c808db1&d=7&i=w.x.y.z&s=x86&v=ver&t=yyyy-mm-dd hh:mm" mode=http dst-
       path="phpresult" 
[admin@dzeltenais_burkaans] /system script> run 0
      status: downloading
  downloaded: 0KiB
    duration: 1s

Wich version of ROS?

I now copypasted the code you wrote and the same thing. hangs and duration just goes on and on…

If I use a browser, I get a 404 error

Not Found

The requested URL /something.hr/mt/update.php was not found on this server.
Apache/2.2.3 (Red Hat) Server at > http://www.some.com > Port 80

ADD: If you can, please put a simple index.html file in the /avatars directory with the tp-avatar.png. I can get your main page index.html file.



Here are the files

I am also getting a 404 error still. I can get the image with a browser, so it must be with the fetch routine. I suggest contacting support@mikrotik.com and see what they say.

I can get the http://www.giganet.hr/index.html doc with fetch. Just not anything in the avatars directory.

<html><head><META HTTP-EQUIV="refresh" CONTENT="0;URL=/cgi-
            sys/defaultwebpage.cgi"></head><body></body></html>

I just tried a php file fetch from my site and it downloaded the output of the php file, not the actual file.

ADD: You might want to check your file and directory permissions on the /avatars/ directory and see if anything is different from your main directory also.