Results 1 to 6 of 6
Thread: Runnig PHP from PHP
02-09-08, 04:14 PM #1
Runnig PHP from PHP
I want to read in the XML from an RSS feed generated by WordPress. The feed is generated by a PHP script with a URL like www.example.com/blog/?feed=rss2 I would like my new PHP script to get the results from the URL so I can process it.
I tried calling file_get_contents(/blog/?feed=rss2), but it didn't like that. Anyone know how to do this?Once there was a caterpillar who had commas for legs. Which meant he had to allow a literary pause after each step. The other caterpillars really respected him for it and he came to have quite a commanding presence. Oh, and talk about a philanthropist! He was notorious for giving fresh leaves to those less-fortunate.
02-09-08, 04:39 PM #2
Make sure allow_url_fopen is set to True in the php.ini file. Other than that more details would be helpful.
Web Server (apache, iis, ...)
OS (Windows, Linux, ...)
Specific error you are getting.
02-09-08, 04:53 PM #3
Thanks, that's exactly what I needed. I didn't think my host would let me change that setting, but I was able to find the php.ini file and change it. Here is what my code looks like that is working after that change.
<?php $file0 = 'http://www.example.com/blog/?feed=rss2'; $source0 = file_get_contents($file0); echo $source0; ?>Once there was a caterpillar who had commas for legs. Which meant he had to allow a literary pause after each step. The other caterpillars really respected him for it and he came to have quite a commanding presence. Oh, and talk about a philanthropist! He was notorious for giving fresh leaves to those less-fortunate.
02-09-08, 07:34 PM #4
Just out of curiosity for a problem I'm having...
Can you use change your $file0 variable to pull a page over https? No biggie if you can't or don't want to, I'm just having a problem using file_get_contents with a https url.
02-09-08, 11:49 PM #5
Notice: file_get_contents() [function.file-get-contents]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in C:\www\test2.php on line 3 Warning: file_get_contents(https://apps.asu.edu/CitrixLogonPoint/Apps/) [function.file-get-contents]: failed to open stream: Invalid argument in C:\www\test2.php on line 3Project Silver
Intel Core i7-4770k (4.3GHz @ 1.265V)
Asus Maximus VI Hero
G.Skill Sniper 2x4GB DDR3-1866
EVGA nVidia GeForce GTX 760
Samsung 840 Pro 256GB
Thermalright Venomous X || 2x 120mm Panaflo || Arctic Silver V
Lian-Li PC-A77FA || Vantec Nexus Fan Controller
02-10-08, 08:20 PM #6
Thanks kayson. I'm just getting a blank page. Something isn't right in my config. If I ask anymore about this I'll start a new thread.