PDA

View Full Version : fopen()


Farley
8th December 2003, 01:16 PM
If I get to be too much of a pain, just throw some pies at me.... :p

2 Questions.

Q1:

:scratch: Why doesn't this work?
$page=fopen("http://www.yahoo.com","r");
The page doesn't send any errors, flashes, but doesn't redirect. The Meta refresh tag works, but is it ok to use meta tags outside the header?

Q2:

Upon sucsessful redirect, is there a way to foward a username/password. ie: We use a GPS tracking/text system in all the trucks. I can send a message to a truck throught Inet, but you gotta log in. I don't know the technical terms but, its not a webform login, a seperate text box pops up. I can tick the "save name/pass" checkbox, but this still requires a enter key stroke.

Thanks

:)

Nanobot
8th December 2003, 01:50 PM
There is more than one way to include an external page on your page, so if you could give more information on what you want to do when you have "read in" the yahoo page then a suitable solution can be arrived at :D

As for redirecting and logging in you can put the username and password on the url e.g. http://yourusername:yourpassword@www.somewheresafe.com it is not a recommended solution unless you are populating the username and password dynamically :)

jema
8th December 2003, 01:52 PM
Well for Q1 I think you are misreading what fopen is meant to do. I think you are trying to do what would be done by:

$page=fopen("http://www.yahoo.com","r");
fpassthru($page);

for the second part, i think you may need to do what I do in Foboz, e.g. if the second page has a form, then figure out what needs to be send on that forms GET/POST procedure and do that rather than go through the form at all.

jema

Farley
8th December 2003, 10:14 PM
What I want to do is search the db for new data, a new vehicle calling. Setup up a macro.exe to cycle every five minutes and if there are new records then send the info to our GPS/texting stuff.

The way the GPS/texting works: The site is here (http://www.road.com) and we can enter text after logging in and going to the messaging page, blah blah blah. But something else they have is a way to text message the truck straight from a URL. I do this in my Approach apps by pasting the URL with the Vars into the address bar. Works good. If you don't close the browser you only have to sign in the first time. I wanna do that with the SQL on the site now.

So here was my plan. make a page to refresh every 5 minutes, search for update field "No" if True then parse the results vars into the URL and redirect to that URL. That should send it to the truck. But logining in requires user intervention, maybe it will be ok if the widow stays open, gotta test that part yet :)

The "backdoor: URL look like this https://www.road.com/apps/SendOutbMessage?Vehicle_Label=Truck number here&Message_Text=Message Here

I tried the Dynamic login as Nano suggested, I use that with my FTPs, but doesn't seem to work for this on a trial run. :(

What does "fpassthru($page);" do?


See if that will explain it better

Thanks

:)

[Edit] The dynamic username:PW works. :rolleyes: I had it in the wrong order. :rolleyes:
Problem #2 solved :)

[edit2]
fpassthru
(PHP 3, PHP 4 )

fpassthru -- Output all remaining data on a file pointer
Description
int fpassthru ( resource handle)


Reads to EOF on the given file pointer from the current position and writes the results to the output buffer.

I don't think that will do what I want.