...

View Full Version : CURL get PHP



DJCMBear
12-13-2010, 05:54 PM
Hi I am just wondering can you do something like this with PHP CURL, I read everything about CURL on php.net but still unsure as I haven't really used CURL before.

Basicly I want one server to get files from a different server and use them like this.

sever 1 root
- folder
- file.php - contains '$username = "test";'

server 2 root
- file.php - contains 'print $username;'

This will be something similar to what Facebook do for their Application developers, where they read a file that they have given the developer with their codes in and it allows them to search their databases to see if the information is correct etc, can I do this with CURL or not?

Thank you
DJCMBear

Rowsdower!
12-13-2010, 08:42 PM
cURL is used to retreive the returned result from visiting a page. It will return a string if you capture the data (rather than just cURL'ing wide open, which will print the string to the page directly). You can read the cURL result to parse it for the data you want, but you can't use it as a method to directly include PHP as your example indicates.

So, yes - if you parse the cURL's string data before you try to use it. Otherwise, no.

See this page for the explanation that cURL returns a string:
http://www.php.net/manual/en/function.curl-multi-getcontent.php


P.S.

See the eval() function if this ends up being the route you want to go. Beware though, that any malicious script plopped into the target page WILL run on your server.

http://php.net/manual/en/function.eval.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum