[PHP-DB] fopen() question and auto update question
has any of you have any problem with fopen() that it can't open some web page? i am trying to use it to gather information from other web pages, but i am having problem with one particular website, macmall.com. might anyone know what the problem is? also, if there is no solution to this, i am going to have to abandon the idea by using fopen() to gather information. can anyone suggest an alternative way, which won't cost me too much time to get to it? there will be around 200 data to be updated each time. thanks a lot. Tony S. Wu [EMAIL PROTECTED] The world doesn't give us hope - it gives us chance. http://homepage.mac.com/tonyswu/tonyswu- My web page. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] fopen() question
I have a database and I am writing a script to auto-update some information in the database. That requires me to read data from database, find the URL, read the URL, find the information I want, then update it in the database. My problem is, for example I read one record from database who's URL is http://www.somedomain.com/. And I try to read the URL with fopen() for information: $fp = fopen(³http://www.comedomain.com/², ³r²); if (!$fp) { echo ³URL not available.²; exit; } If the URL is available, things will work fine. But if the URL is NOT available, I will get a error saying ³attempt to load file ³MyFile¹s URL² failed² from browser. It¹s supposed to output the string ³URL not available², isn¹t it? Anyone know how to get around with this? Tony S. Wu [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] fopen() question
Also, if you check many URL's from the same script, make sure neither PHP nor the browser times out. For PHP, set_time_limit() and for the browser echo a space and flush() after each test. Bogdan Bogdan Stancescu wrote: Try $fp=@fopen( etc Bogdan Tony wrote: I have a database and I am writing a script to auto-update some information in the database. That requires me to read data from database, find the URL, read the URL, find the information I want, then update it in the database. My problem is, for example I read one record from database who's URL is http://www.somedomain.com/. And I try to read the URL with fopen() for information: $fp = fopen(³http://www.comedomain.com/², ³r²); if (!$fp) { echo ³URL not available.²; exit; } If the URL is available, things will work fine. But if the URL is NOT available, I will get a error saying ³attempt to load file ³MyFile¹s URL² failed² from browser. It¹s supposed to output the string ³URL not available², isn¹t it? Anyone know how to get around with this? Tony S. Wu [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php