Convert CURL Result Into A Variable
I have am XML query sent through cURL. The query that is sent returns another xml file which contains more info (for credit reports i.e., you send a name, ssn etc and get back the result)
The problem is the reult comes back like this: "Firstname lastname ssn otherinfo .. . . . ."
I think the explode function would work well with this but first I need to convert the cUrl result into a a variable.. Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Weird CURL Result
I am having a problem using curl and when it returns the page it has all of the images listed as local files to my server, I am assuming this is because the design of the site I am accessing, but shouldn't cURL recieve the site the same way a browser does and not show files local to me. I can adjust it using string replace methods but it seems a bit troublesome to do so:
View Replies !
Curl GET (url) Variable
Having some difficulty in a code with a GET variable. I tried to put the variable in the url and now trying to post it as a get variable seperatly. $cUrl = curl_init(); curl_setopt($cUrl, CURLOPT_URL, 'http://site.com/c.php'); curl_setopt($cUrl, CURLOPT_GET,1); curl_setopt($cUrl, CURLOPT_POSTFIELDS, 'id=100494&'); curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($cUrl, CURLOPT_TIMEOUT, Ɖ'); curl_setopt($cUrl, CURLOPT_PROXY, $buffer); $pageContent = trim(curl_exec($cUrl)); curl_close($cUrl); print "$pageContent"; Also using a proxy... I changed id=100494& with id=100494 býut didnt seem to have any effect either. My output is "1"
View Replies !
How To Convert Variable To An INT
I have a form looking for a numeric value. It is scripted to not allow anything but. My issue is that when I enter it into the database, I believe it is entering it as a string. The database contains a field set to accept INT and it is not accepting the values entered. It is inputing something totally different.
View Replies !
Convert A Variable Name To A String
How do I convert a variable name posted from a form element into a string?I.E: -------------------------------------------------------------------------- From: $1011 = "10"; // Product ID and the value of the Quantity to: $product_id = "1011"; $quantity = "10"; -------------------------------------------------------------------------- Unfortunately my client has already had the site built entirely in Flash, so there is not much I can do about getting the form changed.
View Replies !
Result Mysql As Variable
I have an select on which the user choose property, arrival and departure dates for calculating the price, works perfect. But I need to put in some sort of error if the person choose dates higher than end date in the database, What I want to do is this, but don´t work of course: sep_fin is an datecolumn in the database if ($salida>"sep_fin") { echo "¡ There are no prices yet!"; } elseif ($row = mysql_fetch_array($result)){
View Replies !
Curl Load Page That Has Variable In Url?
I'm trying to load a page that has a variable in the url. Such as: index.php?name=bob I tried acting like the page was just a normal page (such as index.php) but that didn't seem to work. How do I give the server the variable in the url?
View Replies !
Convert Loop Results To A Variable
I've got this script: foreach($subscribers as $count => $subscriber) { // split subscriber info into array $info = explode('|', $subscriber); $email = $info[0]; $joined = $info[1]; $joined = strftime("%D", $joined); print "<b>Subscriber $count</b><br>"; print "Email: $email<br> "; print "Joined: $joined<br> "; print "<br> "; } I need the results of this loop to be converted into a variable. This variable will be returned to Flash and displayed in a text field. Right now, the results of the loop are being displayed in html. Can anybody help?
View Replies !
Getting MYSQL Result Into Single Variable
I have a MYSQL query running that returns a single string of data but it is returned as an array. What I need to do is store that single piece of data in a variable. I know it's probably a really simple process but it has been irritating me for far too long. the result I get when I use print_r($result) is: Array ( [ADDDATE(񟭇-04-05', INTERVAL 6 DAY)] => 2007-04-11 ) I can't figure out how to store the 2007-04-11(the result) into a single variable named $end_date.
View Replies !
Fetch Variable From Another Domain Fsockopen Or CURL ?
I have a script that needs to check the 'mother site' for version information. The site contains an updates.php page that simply contains one variable $current = 1; I initially tried to simple add this page as an include but found it would not work. I have been having a look around and it seems that I have two options. fsockopen or cURL. I know nothing about cURL and have never used fsockopen (we are off to a good start aren't we :rolleyes: ) So before I take a hike up the learning curve I just thought I would get some advice on what would be the best option. The server the update.php page is on has cURL enabled. Code:
View Replies !
Assign MySQL Function Result To PHP Variable
I know to use: mysql_fetch_row($result) to convert a row from a SQL query result set into an array for use with PHP. but in the case of SQL queries that return one value, such as calls to MySQL functions, is there another PHP mysql api function I should use. For example, right now I use a "workaround" technique from PHPBuilder: $result=mysql_query("SELECT COUNT(*) FROM tablename"); list($numrows)=mysql_fetch_row($result); Rather than using this "workaround" code is there a way to simply assign the result of the MySQL function query to a variable. $result=mysql_query("SELECT COUNT(*) FROM tablename"); $numrows=mysteryfunction($result);
View Replies !
CURL Problem.. Comparing Output From IE/CURL Differs
I'm writing a tiny php app that will log into our bank of america account and retrieve a file containing a list of checks that cleared the previous day. The problem I'm running into is when I perform actions with php/CURL the output is different than when I use IE and I'm completely stumped as to why. The final output should list files available for retrieval but the CURL output displays an error/empty file message. Here is the curl portion of my code:
View Replies !
CURL Functionality Without Using CURL
I'm porting some code from C++ to PHP, and the C++ application I'm porting from uses the cURL library (http://curl.haxx.se/). The library is used to both make requests to a internal website at my work and to look at returned response codes (200, 401, 404, etc). It then takes appropriate action, based on the response code that was returned. Due to a number of issues, many of which I cannot control, I am unable to make use of the PHP port of the cURL library. I need to do user authentication, and check response codes for websites (again, codes like a 404 not found). How can I go about doing this without using the cURL library? Are there native calls available for me to do this kind of thing? If so, what are they? What other alternatives exist? Native alternatives would be ideal, since I'd like to avoid third-party dependencies if possible. Thanks in advance for any help you might be able to provide!
View Replies !
Displaying Result 1-8, Then Result 9-17 Etc.
I dispaly the results from the database like this. <? while ($row = mysql_fetch_array($prod_result)) { $small = $row[0]; echo"<td align=center><img src="produkter/hardware/decks/$small"></strong></td>";}?> But if there are more than 8 results, I wnat to dispaly the first 8 on one page, then the next 8 on the next page...How can this be done?
View Replies !
Exec(curl --proxy ....) Or Passthru(curl --proxy....)
I am trying to do some proxy stuff , I am able to retrieve the page but not able to catch the return , what I am doing is passthru("curl --proxy 195.115.142.120:80 xyz.com"); or exec("curl --proxy 195.115.142.120:80 xyz.com"); It throws the results (displays the xyz.com) to my page but I want to catch that in a variable like $variable=passthru("curl --proxy 195.115.142.120:80 xyz.com"); or $variable=(some php fucntion)("curl --proxy 195.115.142.120:80 xyz.com"); echo $variable , should give me the page.
View Replies !
Nesting Result Loops Within Result Loops Possible?
I'm looping through a query, and inside the while result output, I am trying to loop through a second query (created from the 1st query's row results). I have checked that both queries return info. I can see that the 1st while result output works fine, but when I get to the inner while result output, it never returns any rows (nothing in the while loop evaluates). So, IS it possible to nest one query's output loop within another, or am I doing something wrong?
View Replies !
Creating A Result Page From A Result Page...
I have a contact management database (4500 records) where each record contains many columns = a lot of data to look at in one go. So... I have created a search page to look for "Company" or "Name" which then returns a recordset with a primary ID number and a summary of 5 other fields. This recordset is then displayed on a results page in a dynamic repeating table which just shows simple record lines. My aim is to then be able to go from the results page to another detailed result page based on the ID of a specific selected record. I understand how to generate the recordset from a text box but cannot find out how to create a recordset from a dynamic repeating table.
View Replies !
Including A Variable In A Variable Before The First Variable Is Defined.
Is there any way to do this? $date = getdate(); $day = $date['mday']; $var = 'Hello have a ' . $var2 . 'day'.; if ($day == 7){ $var2 = 'bad' echo $var; } if ($day == 8){ $var2 = 'good' echo $var; } So that if it is the 7th, it would give "Hello have a bad day.", and if it is the 8th it would give "Hello have a good day."? All that I've tried doesn't work, because it doesn't seem I can define $var2 after it is stated in $var even though it is not echoed until after.
View Replies !
Loop Through Array And Create Variable Session Variable Names
As part of my user authentication class I've written a method that sets session variables. I pass an array to the function by reference which contains elements populated with information from the users table in the DB (name, street, country etc) At the moment the function looks like this: /* Set the session variables for easy access to user data */ function _setSessionData(&$userData) { $_SESSION['loggedOn'] = true; // Logged on $_SESSION['userID'] = $userData['UserID']; $_SESSION['username'] = $userData['UserName']; $_SESSION['password'] = $userData['Password']; $_SESSION['firstName'] = $userData['FirstName']; $_SESSION['surname'] = $userData['Surname']; $_SESSION['email'] = $userData['Email']; $_SESSION['street'] = $userData['Street']; $_SESSION['city'] = $userData['City']; return true; } What I'm wondering is if it is possible to loop through the $userData array, and dynamically name and populate the session variables rather than listing them all and assigning like I have?
View Replies !
Help On Using Curl
I wanted to accomplish these task: 1. from that webservice get a certain set of strings from the header 2. next, generate the image. and these 2 steps will be done at the same time. to get the header value: $ch = curl_init(); $timeout = 0; curl_setopt ($ch, CURLOPT_URL, $xmyurl); curl_setopt($ch, CURLOPT_HEADER, 1); ob_start(); curl_exec($ch); $s=ob_get_contents(); now from the same url i want also to generate the image on the file. if just to create the image: $ch = curl_init(); $timeout = 0; curl_setopt ($ch, CURLOPT_URL, $xmyurl); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); // Getting binary data curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); $image = curl_exec($ch); curl_close($ch); now...how to combine both functions?
View Replies !
Php 4 Vs 5 With CURL
I have a simple script that uses cURL to grab data from a server and display that in the browser. I can get it to work fine on servers with php4, but it won't display in the browser on servers with php5. It works for both through the shell though. Here is the cURL code: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 90); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str); //curl_setopt($ch, CURLOPT_NOBODY, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_ENCODING, "x-www-form-urlencoded"); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $res = curl_exec($ch); curl_close($ch); $resp = explode("", $res); $header = explode("", $resp[0]); $body = explode("&", $resp[1]); echo "<pre>"; print_r($header); print_r($body); echo "</pre>"; Does anyone know why this would break in PHP 5?
View Replies !
If Curl
i'm using curl, to extract details of a web-page... HOWEVER - Sometimes the (valid / correct) HTML output retrieved - is blank / No value... Ie it only retrieves information - ifit exists (of course)... EG - on yahoogroups - Pending members (download page).... - If you have no pending members - there will be no output.... CURRENTLY - i have $result = curl_exec ($ch)); and then saving the resuts to a file... - I'm thinking - of changing it to below :- im just wondering - If there are no pending members - there would be no preg-match with w etc... ive uploaded the following - & think the below code will work - Just checking / confirming here....
View Replies !
Curl Twice
I'm using curl to invoke a php script on the same site/server. It works great, but if I call it again while it's still running, nothing happens. Why? Can that be fixed? Why use curl? To make it run in the background. My host can't use exec nor flush the output to the browser. But, I can use curl and timeout.
View Replies !
CURL And SSL
I need to screen scrap a page using CURL. I've been trying for hours the access it, but I can't bypass its SSL protocl. This is the code I've been using private function ucitaj($url) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($ch,CURLOPT_RETURNTRANSFER,1); $result = curl_exec ($ch); curl_close ($ch); return new SimpleXMLElement($result); } This is the page it try to grab: https://konet.kovanica.hr/tecajna?d...as_attachment=0 I tried googling for a solution, but i failed miserably. I don't know what i+m doing wrong , and what I need to do to solve it.
View Replies !
PHP CURL And XML
I am newbie to PHP and need to do a couple of things. 1) Receive XML posted by another site to our site. The url that will be given for external parties to post to our site would be two fields of data......
View Replies !
Php With Curl On IIS
i need someadvice on how i may troubleshoot this problem. I am trying installing php (4.4) to run includes remotely on windows server (IIS 6 win 2k) with the extension Curl. I added the extension and php is running fine however php test continually throws out an error as follows: P Warning: Unknown(): Unable to load dynamic library 'C:PHPExtensionsphp_curl.dll' - Access is denied. in Unknown on line 0 can anyone advise how to get over this problem? the php files are all from the same install and i (aparently) have the correct system32 dll's.
View Replies !
Curl()
Can I use curl to get the contents of a div tag from a remote page?? Basically I want to say goto www.awebsite.com/page.html and gather all of the info in a div say <div id="mydiv">Content I want</div>
View Replies !
PHP Curl
My checkout process page adds all the order and customer data to my database tables. There is an HTML form in the HTML of that page that is submitted by javascript onload that posts the required data I have already collected to the Payment Gateway. On sucsessfull payment, the Order in the database is flaged as paid. Process completed. It all works fine, But I dont like using javascript to post the form and I dont like having the form data visable. I had a look around and it seems I should be using Curl to post the data to the Payment Gateway. I can get my curl script to work and post all the data to the payment gateway, but... It is returning the HTML and displaying it in the page. I would really like it to post to the payment page and follow it to it. The Payment gatway page is on https and my page is not. So is asks for payment details on http not https. Does anyone know what i should do to make Curl go to the page rather than display it? Here is the Curl code, I have not put the details in for security reasons. But it all works and displays the page. Code:
View Replies !
CURL, PHP, And SSL
I'm using php 5.1.2 on apache 2.0.54 and am trying to use curl to connect to an ssl server. Curl works fine using http, and the command-line client works with https. But, in php, I just get error 7 when trying to connect through https. So, the problem would seem to be with php's bundled curl support. I am on WinXP, and everything is installed through binaries. Here's an example of my code: $ch = curl_init("https://login.yahoo.com"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_exec($ch); curl_close($ch); Here's partial output from curl_version(): [version_number] => 462336 [age] => 2 [features] => 540 [ssl_version_number] => 0 [version] => 7.14.0 [host] => i386-pc-win32 [ssl_version] => OpenSSL/0.9.8a [libz_version] => 1.2.3 [protocols] => [0] => ftp [1] => gopher [2] => telnet [3] => dict [4] => ldap [5] => http [6] => file [7] => https [8] => ftps I notice that although I have an entry for ssl_version, I just have "0" for ssl_version_number. Looking at others' outputs on the web, it looks like most people have a non-zero value there. As far as I can tell, I have all the pertinent dlls (libssl32, ssleay32, libeay32) in the right place (all over after all my attempts to fix this). My apache is not set up for ssl, but since php/curl is the client, that should be irrelevant.
View Replies !
How To Use CUrl
How to use CUrl??? What are the libraries to be included using the require_once command?? I wanted to implement Range Header and get a part of file thru HTTP. So found that curl_setopt() method will be useful. Is curl comes with the new php installation for windows 2000?? If not how to install it?? Is it easy to insatll?
View Replies !
Getting CURL Going
I have installed cURL and recompiled PHP with cURL support. However, when I restart apache I get a "PHP4_module is already loaded, skipping" message. Apache restarts and I can access PHPINFO, but the curl module is not loaded, and the Configure Command listing does not show the most recent configure command that included, --with-curl=. Php recompiled with no error, any ideas?
View Replies !
CURL
Code: <?php $page = "http://neopets.com/login.phtml?username=test&password=test&destination=/stockmarket.phtml"; $ch = curl_init($page); // set URL and other appropriate options //curl_setopt($ch, CURLOPT_URL, "http://neopets.com/login.phtml?username=TEST&password=TEST&destination=/stockmarket.phtml"); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); Also, it turns out there's a piece of javascript that blocks scripts from logging in, any way to bypass.
View Replies !
What? Assigning A Session Variable Also Assigns The Local Variable?
Alright, In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is burns. Here is the code: $frank = "burns"; $_SESSION['frank'] = "black"; echo "DEBUG: frank's last name is is $frank"; What is coming into play here? I thought of register_globals but I thought that only dealt with GET, POST, REQUEST, etc.
View Replies !
Passing Multiple Variable Errors...last Variable Vanishes.
I have been trying to figure this one out for a few days now and it is starting to drive me mad. I'm sure this is something simple that I have done wrong but I can't for the life of me figure out what is wrong here. Some background. I decided I needed to learn PHP, I really enjoy it but keep getting stuck on things like this due to my lack of knowledge. So I set myself a challenge to write a PHP CMS system using PHP, mySQL, XHTML and CSS. All was going fine (all be it rather slowly) until I tried to write the page to edit articles in the CMS. I have the 'ID', 'title', 'venue' and 'article' stored in the database fine. I can pull entries out and display them fine. I now want to edit them using a browser. So I thought I would use the same form I used to add mySQL entries and change ti so that it loads in the article into the form fields depending on the id. (This is chosen through a link saying 'edit). Code:
View Replies !
How To Make The Mail Script Print The Name Of The Variable Before The Variable.
I have my mail script working. It sends correctly to the box specified, all data is correctly passed both in the email and in the sql db. My question is about how to make the mail script print the name of the variable before the variable. Joe Blow joe@blow.com I want it to look like: Name: Joe Blow Email: joe@blow.com I am not sure how to do this, and the little things I have tried just break my script. Can anyone point me in the right direction.........
View Replies !
$_GET Variable - Call The Variable Through The Include File
I'm using an include with a variable url. I'm trying to call the variable through the include file but it's giving me this error: Warning: include(message.php?word=hello) [function.include]: failed to open stream: Invalid argument in C:AppServwwwdirectory_here.php on line 281 PHP Code: // index.php <?php include ('message.php?word=hello'); ?> //message.php <?php echo $_GET['word']; ?>
View Replies !
How To Convert Asp To Php
I have a database system coded in asp using dreamweaver mx. Can I convert the code to php by using dreamweaver mx ? If can, please tell me how. Currently I'm using PWS on Windows ME with MySQL as a database.
View Replies !
|