| | |
Page Searcher
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
What you are looking for is Curl
http://us.php.net/manual/en/curl.examples.php
http://us.php.net/manual/en/ref.curl.php
http://us.php.net/manual/en/curl.examples.php
http://us.php.net/manual/en/ref.curl.php
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
•
•
•
•
Note sure exaclty how I would use it? Can you explain more please
php Syntax (Toggle Plain Text)
<?php $ch = curl_init() or die(curl_error()); curl_setopt($ch, CURLOPT_URL,"http://search.msn.com/results.aspx?q=test&FORM=MSNH"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data1=curl_exec($ch) or die(curl_error()); echo "<font color=black face=verdana size=3>".$data1."</font>"; echo curl_error($ch); curl_close($ch); ?>
and rather than echoing the data to the page you just use string and array functions to parse and search through the $data1 variable.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
Also, assuming your server host didn't disable this feature (enabled by default) for security reasons (allow_url_fopen) you can also get the contents of a file via URL with ...
file (returns file as array, split on linebreaks)
fopen (opens read/write/append file-handle)
file_get_contents (returns whole file as string)
Write ups of these functions
file -- http://us.php.net/manual/en/function.file.php
fopen --- http://us.php.net/manual/en/function.fopen.php
file_get_contents -- http://us.php.net/manual/en/function...t-contents.php
allow_url_fopen -- http://us2.php.net/manual/en/filesys...llow-url-fopen
Just thought you might like to know
file (returns file as array, split on linebreaks)
fopen (opens read/write/append file-handle)
file_get_contents (returns whole file as string)
Write ups of these functions
file -- http://us.php.net/manual/en/function.file.php
fopen --- http://us.php.net/manual/en/function.fopen.php
file_get_contents -- http://us.php.net/manual/en/function...t-contents.php
allow_url_fopen -- http://us2.php.net/manual/en/filesys...llow-url-fopen
Just thought you might like to know
PHP Syntax (Toggle Plain Text)
<?php $word = 'search'; // found //$word = 'phat'; // not found $file = file_get_contents( 'http://www.google.com' ); if ( preg_match( "/$word/i", $file ) ) { print "word: $word"; } else { print "phat"; } ?>
Last edited by langsor; Aug 15th, 2008 at 2:07 am.
•
•
Join Date: Jun 2007
Posts: 11
Reputation:
Solved Threads: 0
Even better, this will make my job 10 times easier.
•
•
•
•
Also, assuming your server host didn't disable this feature (enabled by default) for security reasons (allow_url_fopen) you can also get the contents of a file via URL with ...
file (returns file as array, split on linebreaks)
fopen (opens read/write/append file-handle)
file_get_contents (returns whole file as string)
Write ups of these functions
file -- http://us.php.net/manual/en/function.file.php
fopen --- http://us.php.net/manual/en/function.fopen.php
file_get_contents -- http://us.php.net/manual/en/function...t-contents.php
allow_url_fopen -- http://us2.php.net/manual/en/filesys...llow-url-fopen
Just thought you might like to know
PHP Syntax (Toggle Plain Text)
<?php $word = 'search'; // found //$word = 'phat'; // not found $file = file_get_contents( 'http://www.google.com' ); if ( preg_match( "/$word/i", $file ) ) { print "word: $word"; } else { print "phat"; } ?>
Ya, I guess Curl is a bit overkill for what you want to do with it, but it is a good thing to learn though as the options are limitless.
If you ever decide to play with it, here is a pretty good tutorial:
http://www.phpbuilder.com/columns/ia...n20050525.php3
If you ever decide to play with it, here is a pretty good tutorial:
http://www.phpbuilder.com/columns/ia...n20050525.php3
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
•
•
•
•
Ya, I guess Curl is a bit overkill for what you want to do with it, but it is a good thing to learn though as the options are limitless.
If you ever decide to play with it, here is a pretty good tutorial:
http://www.phpbuilder.com/columns/ia...n20050525.php3
I've actually been avoiding learning CURL since it seems complicated, and I'm lazy, but I know I should figure it out too. I bookmarked that tutorial.
Cheers
![]() |
Similar Threads
- Help me get spyware! (Viruses, Spyware and other Nasties)
- win min + quick-searcher hijack (Viruses, Spyware and other Nasties)
- IE hijack (your-searcher.com; win min) (Viruses, Spyware and other Nasties)
- regedit and sfc dont open (Viruses, Spyware and other Nasties)
- Internet Explorer hijacked (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: need help in send and email
- Next Thread: how to tell php to set into Utf-8?
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary broken buttons cakephp checkbox class cms code cron curl database date directory display dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm mod_rewrite multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web webdesign websphere white xml youtube





