Reputation: 1972
I first send a term to a webpage outside my site. Then that page returns only text. I want to take that text and process it? So I'll have to get that text on my server for that right? So how can i do it? or is there any other option?
Upvotes: 1
Views: 1051
Reputation: 1413
Below is the code to read remote file using PHP
if ($fp = fopen('http://www.google.com/', 'r')) {
$content = '';
while ($line = fread($fp, 1024)) {
$content .= $line;
}
} else {
// an error occured when trying to open the specified url
}
Make sure you have 'allow_url_fopen' set to 1 in your php.ini
Upvotes: 1
Reputation: 105906
Use cURL or file_get_contents() if your server has the URL wrappers enabled.
Upvotes: 2