Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
From a PHP page (http://example.com/test.php), I would like to call another PHP file located on another web site (http://newsite.example.net/version.php) and passing parameters (var1=123, var2=789). Version.php should do something and return true or false, so I can test the result in test.php (if ($result) ...)
Any short exemple how to proceed and what should be the content of the fileversion.php ?
Regards,
David
Executing a php script in such a way is equivalent to performing an http query. As such, the only result you can expect from the url you call is a http response (plain text, image, json - whatever mime type the page can output).
It can be done for example with file_get_contents() (provided your php configuration allows it) :
$contents = file_get_contents('http://somesite.com/somepage.php?someparameter=somevalue');
You could then process the resulting content text however you like. But you won't ever get direct boolean output. numbers (0 or 1) could be suitable replacements for your needs, however.
Edit:
The version.php might look like this :
<?php if($condition) { echo 1; } else { echo 0; }
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I just received a source from my customer (it's written by PHP Generally), I try to read it and glance at database. I realize that it's very mess, some webpage's content is also saved in database. So, I want to find files are using by browser and I mean that php files, I want to edit them. Can I do that?
P/S: I'm sorry if this article bother you
Hi At any point you need to know what functions, what includes and what arguments are being passed just use debug_print_backtrace() function in your code.
for further reading follow http://www.php.net/manual/en/function.debug-print-backtrace.php
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I am trying to call drupal 6 URL from my local system, that URL will generate a xml file.
My system does not have drupal intallation. I tried file_get_content("www.abc.com") but it does not write my xml file but when I try to run the url normally it runs and xml file gets generated.
Thanks in advance
You can use sockets or just file_get_contents, like
$homepage = file_get_contents('http://www.example.com/');
echo $homepage; // $homepage contains server response without headers
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
http://www.aliexpress.com/item/NEW-7-Android-2-3-256MB-DDR2-4GB-NAND-Flash-7-inch-tablet-pc/498159194.html - I got this link
Here you can see a buttons: bundle, color
If you click some of them the price will change, but the question is how can I parse that behaviour to my page via php?
The problem is that I can't understand where is javascript code that executes this, or how to find it, maybe someone got ideas about that?
Inspecting that page's source code I can see that the skuProducts variable in javascript contains this information encoded into a JSON-string. You can't really run this javascript code on your webserver, so you'll have to devise another way to get that variable's value - and then you can use json_decode() to get the contents.
Note that changing the amount of items results in an AJAX call to a shipping costs calculator. You could probably simulate that, but I'm not sure that webshop would like that (and it might be illegal).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
here is an example, say every item in each list was clicked on http://katproxy.com/the-big-bang-theory-tv8511/, how would you proceed to get the source code of the modified web page using php considering the fact that the url has not changed (file_get_contents is probably out of the question).
Thank you!
Using PHP? You can't, not without fetching the page source and evaluating its JavaScript, which is obviously quite impractical.
The "page" hasn't change, only your in-browser representation of the DOM has been modified. You would need PHP to talk to your browser, and ask for the state of its DOM, not the remote server, which cannot possibly serve up the HTML representation of your browser's current DOM.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am trying to read a file, but it keeps printing all of the data to the page without my asking it to do so.
The code is:
<?php
$htmlAppointmentPage = readfile('AppointmentPageTemplate.html');
?>
That's all of the code. For some reason it's echoing the contents of AppointmentPageTemplate.html.
You want file_get_contents() and not readfile().
From the Manual:
This function is similar to file(), except that file_get_contents()
returns the file in a string, starting at the specified offset up to
maxlen bytes. On failure, file_get_contents() will return FALSE.
file_get_contents() is the preferred way to read the contents of a
file into a string. It will use memory mapping techniques if supported
by your OS to enhance performance.
Please note that if your file is very large, it would take a lot of memory (= the file's size) to place it into a variable. Make sure you don't go over the limit set in php.ini.
readfile reads the contents of a file and outputs them to the page.
To get the contents of a file as string (and assign them to a variable), use file_get_contents