Jump to content

Search the Community

Showing results for tags 'curl'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 7 results

  1. GREETING: One more quick question before the weekend begins. BACKGROUND: Until now, it has been easy to see the results of AJAX calls in the files that produce them. Until now, cURL was never an explicit part of my web-application. I am now making a dual call, however, and am unable to see the final result. The first call stipulates no method as nothing is sent. The second call is based on the result of the first call and uses the POST method to make the request. Although I can see the contents of the first request, I cannot see the contents of the second. Both files use identical cURL routines and both perform exactly as expected, as AJAX returns everything that is requested. Only the query statements of the URL are different. Even the specified AJAX dataType is the same for both calls -- namely, JSON. Please find below the code that produces the output that I wish to see, but cannot. The PHP for the 2ND AJAX CALL ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log'); ini_set('html_errors', 0); ini_set('display_errors', 0); error_reporting(E_ALL); if (!empty($_POST['ip_addr'])) { $ip_addr = filter_var($_POST['ip_addr'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH); $url = 'https://.../matomo/index.php?module=API&action=index&visitIp=' . $ip_addr . '&idSite=1&period=week&date=today&method=Live.getVisitorProfile&format=json&expanded=0&token_auth=...'; $curl_request = curl_init(); curl_setopt($curl_request, CURLOPT_URL, $url); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, false); curl_exec($curl_request); curl_close($curl_request); } QUESTION; What must I do to make the output of the cURL call visible in the file that produces it without disrupting the AJAX call that retrieves the output that I cannot see. Or, am I missing the whole point of cURL and the data is tranferred directly to the AJAX? But, why would I be able to see it in the first request, but not the second. Roddy
  2. BACKGROUND: My jubilation was short-lived. For the internal server error that was plaguing my site in general is now plaguing a crucial file in particular. Please find below a file that works perfectly well on my local test server, but fails with an internal server error on my host server. Please also note that the file matomo/index.php is located on the same server as that from which the cURL call is made, but under a different domain name. ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log'); ini_set('html_errors', 0); ini_set('display_errors', 0); error_reporting(E_ALL); $url = 'https://.../matomo/index.php?module=API&method=API.getIpFromHeader&format=JSON&token_auth=...'; $curl_request = curl_init(); curl_setopt($curl_request, CURLOPT_URL, $url); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, false); curl_exec($curl_request); curl_close($curl_request); QUESTION: Does cURL not work in such an environment? If it does, then what must I do to make it work? The error.log file contains nothing and the AJAX that made the call does not complain of not being able to access the file. Roddy
  3. <html><center><br><br><br>checks with get headers <form action="#" method="post"> <input type="text" name="webadres" value=" " required> <br> <input type="submit" value="Send" ><br><br><br> </form> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST'){ $sites= $_POST['webadres']; var_dump($sites); if (isset($sites)) { var_dump(get_headers($sites)); } ?> <br><br>Checks with curl get info <?php $url = curl_init($sites); curl_setopt($url, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($url); $info = curl_getinfo($url); print_r($info); curl_close($url); } ?> </html> I made above script to test whether a webadress exists or not. I'm very surprised that a lot of inputs dont give any result, they actually give a php error message. using sites like http://www.facebook.com does not work, for it twitter it runs. pinterest does only run http and not https. I also found sites like http://www.bbc.co.uk or http://www.cnn.com and more giving no result. Can someone explain why this happens and how to securily check the existance of a website.
  4. Hello internet, Recently I have been working with curl sessions and scrapping data from webpages. I have been fairly successful until I tried to access data from pages that are username and password protected. I have the username and password so that's not an issue - but I am not able to get the data on the page. Any thoughts? $username='usr1'; $password='pswd1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'somelink'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password); $out = curl_exec($ch); if(curl_exec($ch) === false) { echo 'Curl error: ' . curl_error($ch); } echo $out; curl_close($ch);
  5. Hey I'm trying to enable curl in PHP so that I can install Magento CMS which is what the company is using tomorrow at my interview So i'm hoping to install it by then and have a play around with it. I am modifying the correct PHP.ini, phpinfo() tells me C:PHPPHP.ini which is the one I am editing. I have removed the semi colon and saved the file: extension=php_curl.dll I have restarted the web server. I have put libeay32.dll and ssleay32.dll into my Windows/System32 and Windows/SysWOW64 folders and have restarted my computer. And still no luck with curl being enabled. I don't get the curl block in phpinfo() and Magento is still saying curl is required. Any ideas?
  6. I am trying to cURL my university login page. I want users to enter their university id and pass in my website, my website will curl to university website, authenticate and then allow them to login or give error accordingly. But my university portal is a jsp page. And after having posted in StackOverflow and other forums before, this is what I came up with. I need further help on where I am going wrong and how to rectify it. <form class="form-horizontal" action="curl.php" method="POST"> <div class="control-group"> <label class="control-label" for="inputEmail">Username</label> <div class="controls"> <input type="text" id="inputEmail" placeholder="Username"> </div> </div> <div class="control-group"> <label class="control-label" for="inputPassword">Password</label> <div class="controls"> <input type="password" id="inputPassword" placeholder="Password"> </div> </div> <div class="control-group"> <div class="controls"> <label class="checkbox"> <input type="checkbox"> Remember me </label> <button type="submit" class="btn">Sign in</button> </div> </div> </form> Now this is my curl.php file: <?php $address = "http://evarsity.srmuniv.ac.in/srmswi/usermanager/youLogin.jsp"; //site URL $post = "username=txtRegNumber&pass=txtPwd"; //Parameters to be sent. Written like GET. $welcomeMessage = "Welcome..."; //This is the message that is displayed when a login is successful $options = array( CURLOPT_USERAGENT => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)', CURLOPT_POST => true, //using post CURLOPT_URL => $address, //where to go CURLOPT_POSTFIELDS => $post, //input params CURLOPT_RETURNTRANSFER => true, //Returns a string value of the request CURLOPT_SSL_VERIFYPEER => false, //Avoid SSL problems CURLOPT_COOKIEFILE => 'cookie.txt', //Save cookies CURLOPT_COOKIEJAR => 'cookies.txt' //Cookies located CURLOPT_USERPWD ==> [username]:[password]); if (strpos($content, $welcomeMessage) !== false){ /* Do whatever,I don't know what to do here though */ } curl_close($ch); //close connections ?> Please let me know where I am going wrong, why I am not able to login and after logging in, how to log out.Thank you.
  7. hello,I need help in my academic project. I need to transfer some data from one php script on one machine to that on another. I am using curl for that. I can use CURLOPT_POSTFIELDS for that but it does not transfer the control to second script. I want to use CURLOPT_FOLLOWLOCATION but how to use it i dont know. So please help me out with some code.this is what i tried.curl.php
×
×
  • Create New...