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

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

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


Age


Donation Link

  1. Hi Team, I am trying to fetch the data from a particular web page using Php curl but unable to do it.Below is my code.It would be great if anyone can help me out in this. <?php error_reporting(E_ALL ^ E_NOTICE); $urlLogin = 'https://vrl.lta.gov.sg/lta/vrl/action/enquireTransferFeeProxy?FUNCTION_ID=F0501015ET'; $urlSecuredPage = 'https://vrl.lta.gov.sg/lta/vrl/action/enquireTransferFeeProxy?FUNCTION_ID=F0501015ET'; // POST names and values to support login $namevehicleNo='vehicleNo'; // the name of the vehicle number textbox on the login form $nametransferDate='transferDate'; // the name of the date textbox on the login form $namebutton='button'; // the name of the login button (submit) on the login form $valvehicleNo ='GZ2466G'; // the value to vehicle number $valtransferDate ='08052013'; // this date should be current date $valbutton ='I Agree'; // the text value of the login button itself $cookies = 'tmp\cookie.txt'; $ch = curl_init(); $postData = $namevehicleNo.'='.$valvehicleNo .'&'.$nametransferDate.'='.$valtransferDate .'&'.$namebutton.'='.$valbutton ; curl_setOpt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_URL, $urlLogin); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $data = curl_exec($ch); curl_setopt($ch, CURLOPT_URL, $urlSecuredPage); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $data1=curl_exec($ch); echo $data; if(curl_errno($ch)) { echo curl_error($ch); } else{ $file = 'content_mjob1.html'; $fh = fopen($file, 'w');// Open a file for writing. if(!$fh){ echo "Unable to create $file"; // Couldn't create the file. } else { fwrite($fh, $data."<br><br>Data1".$data1); // Write the retrieved //html to the file. echo "Saved $file"; fclose($fh); } } /************************************************ * that's it! Close the curl handle ************************************************/ curl_close($ch); ?> Kindly suggest. Thanks in advance!!! Regards, Deepak
  2. hello! I wanna make web proxy. if I use curl or file_get_contents(), I can load one page, but I want when user click on a link in page, link open with my proxy, whats your idea for doing it? If I change the links and download .js files to edit the links, proxy will build but I think there are better ways to do it. tanks...
  3. Alright Im trying to grab product information from google play to display apps such as price, name, author, and app icon. The issue Im having is on my local server everything shows up fine but when uploaded to the server the price is in a different currency(Yen I think) and I want to display only in USD. Im using curl_init at the moment(it a part of a function) I visit the page and it is in the correct currency, but display Yen with the script) $ch = curl_init(); $timeout = 0; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE); $file_contents = curl_exec($ch); if (!$file_contents) { print_r(curl_getinfo($ch)); die; } curl_close($ch); } else { $file_contents = file_get_contents($url); } return $file_contents; } Is there anything I can, or is there another way I could handle getting this information?
  4. Guest

    PHP, Curl, and JSON

    Hey all. I've been playing with curl via the PHP command line, and I came up with this little curl based API interface to display the current BTC price from mtgox.com via the API. I've tried dumping the returned JSON'ized curl information into a string, and I've tried to query it, but so far no luck. I've used this script before for the Github API and it worked just fine. I've come to the conclusion it's because of the way that the JSON arrays are structured. Any help would be appreciated: <?php $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json')); curl_setopt($c, CURLOPT_URL, 'http://data.mtgox.com/api/2/BTCUSD/money/ticker'); $content = curl_exec($c); curl_close($c); $api = json_decode($content); return $api->avg; ?> The above code, when run with php -f btc.php returns an error: PHP Notice: Undefined property: stdClass::$avg in btc.php on line 12 Which makes me believe that my return: return $api->avg; is incorrect. So, I rechecked the API and the return path seems to be: Object->data->avg; So, I restructured my code to test to see if something like this would work: return $api->data->avg; OR return $api->data['avg']; And I receive a non-object error: PHP Notice: Trying to get property of non-object in btc.php on line 13 I was able to accomplish something very similar with Ruby and elinks: #!/bin/bash elinks -dump https://www.bitstamp.net/api/ticker/ > /tmp/btc.json cat /tmp/btc.json | ruby -e "require 'rubygems'; require 'json'; puts JSON[sTDIN.read]['ask'];" however, this is a script that I'd like to take with me (just so I can check on the BTC price on the go without a web browser), and not all of my terminals have Ruby; also elinks -dump is pretty slow compared to curl and PHP. Any ideas how I can access and return the current price within the JSON array?
  5. Hi, my name is Felipe (aka Sabino) and I am new here! This is my first post! I am working on a code to make you grab a direct MP4 file from the vk.com (a russian facebook like social network) My goal is to use another player with the file, like jPlayer, for example. Here is what I've got so far: I know it's ugly coded, but still, I just want to make it work. <?php //pretending to be a browser function download_pretending($url,$user_agent='Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)') { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, 'http://vk.com/'); $result = curl_exec ($ch); curl_close ($ch); return $result; }//function download_pretending($url,$user_agent) $url = $_GET["url"]; $id = $_GET["id"]; $hash = $_GET["hash"]; $url = $url . "&id=" . $id . "&hash=" . $hash . "&hd=2"; $pagina = download_pretending($url,'Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'); $host = get_string_between($pagina, 'host=', '&'); echo $host; echo "<br>"; $ps = array(); $count = preg_match_all('/<source[^>]*>(.*?)<\/source>/is', $pagina, $match); for ($i = 0; $i < $count; ++$i) { $ps[] = $match[0][$i]; } // Function to get the MP4 file URL from the page function get_string_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); } //I know I can make a for, I was lazy echo '<br>'; echo get_string_between($match[0][0], 'src="', '" type='); echo '<br>'; echo get_string_between($match[0][1], 'src="', '" type='); echo '<br>'; echo get_string_between($match[0][2], 'src="', '" type='); echo '<br>'; echo get_string_between($match[0][3], 'src="', '" type='); echo '<br>'; ?> If you test with this url: http://vk.com/video_ext.php?oid=15318088&id=151930229&hash=e5fb57179b1830c3&hd=1 The result will be something like this: http://cs12492.vk.me/u15318088/videos/aa6b0afa06.720.mp4 http://cs12492.vk.me/u15318088/videos/aa6b0afa06.480.mp4 http://cs12492.vk.me/u15318088/videos/aa6b0afa06.360.mp4 http://cs12492.vk.me/u15318088/videos/aa6b0afa06.240.mp4 But if I try to access any of those links, I gives me a 404 error, from vk.com So, I don't know if this is a protection, if the link works only for the IP that loads the page, don't know... If you want to try the script, go here: http://sabino.net16.net/vk/?url=http://vk.com/video_ext.php?oid=15318088&id=151930229&hash=e5fb57179b1830c3&hd=1 Can someone help me? Thanks in advance!
  6. Hello everyone, Would like some direction, as I want to start a project and I'm not even sure if I'm headed the right way. I have a local news site, which I would like to "scrape" various of the news items off it. I already talked with their webmaster, and he said it's good to go. Ok, so I believe (please correct) that a good tool for the job would be PHP and cURL. What about using PHP Simple HTML DOM Parser? I ask because I'm just not sure of where to head. I'm a n00b at this, so diving into this project is various hours... before I even realize if what I'm doing will work or not. So, that's the general direction. Should I use PHP and cURL? (a reference doc I found here) Also, I don't know how this works, yet I would like to "scrape" the page 4-5 times per day (at pre-set times), and then save the info over in my server. So when a user to my website visits, I server the scraped information from my site (as opposed to re-scraping from the original site?). Any thoughts on this project? Thank you very much everyone!
  7. Hi folks, This is the first time I'm using phpfreaks.Hope I'll get a quick solution. I'm trying fetch HTML of page which is publicly accessible. here is the code I used $home="http://actas.rfef.es...ctas/NPortada"; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$home); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_HEADER, TRUE); curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:18.0)Gecko/20100101 Firefox/18.0"); curl_setopt($ch,CURLOPT_FOLLOWLOCATION, FALSE); curl_setopt($ch,CURLOPT_COOKIEJAR, "cookies.txt"); echo curl_exec($ch); curl_close($ch); I'm being redirected to url http://actas.rfef.es...s/NLogin..which is just 0 byte blank page.what I'm doing wrong? Please provide me suggestions,ideas,and correct code to grab the html of that page. Thanks in advance
  8. Hi everyone, this is my first post, because I need to pick your brains a bit Any help is appreciated. Thx ... I'm designing an application for purposes known to just a few people . It's work related. It should take the data provided and insert into form provided below, and automatically submit it. There are no issues on any other page on that domain, I'm able to login, save cookies, read them, go to other links on the same site. The problem I'm having is occurring on the page with the form, specifically, curl executes and fetches the page, but the post data is not sent.(data is sent as array, also tried urlencoded string) It think there might be a problem with the way the form is structured(code below). Also, the site with the form is not mine, but i will provide headers and post variable that are transmitted when form is submitted in browser. So to begin. Form: <form action="newFault" method="GET" id="typeForm"> <div style="margin:5px"> Tip smetnje: <select name="type" id="type"> <option value="SVA" selected>SVA VA</option> <option value="SNBS">SNBS - NBSA</option> <option value="SULL">SULL - ULL</option> </select> </div> </form> <div> <form method="POST" action="createFault" enctype="multipart/form-data"> <input type="hidden" name="type" value="SVA"> <table class="tableLight" cellpadding="0" cellspacing="1" style="margin: 5px;"> <tr> <td colspan="2" style="text-align: right">Virtual account code:</td> <td><input name="accountCode" size="60"></td> <td></td> </tr> <tr> <th>konos</th> <th style="text-align: right">Kontakt osoba:</th> <td><input name="param.konos" size="60"></td> <td></td> </tr> <tr> <th>tel</th> <th style="text-align: right">Telefon:</th> <td><input name="param.tel" size="60"></td> <td></td> </tr> <tr> <th>tfx</th> <td style="text-align: right">Telefax:</th> <td><input name="param.tfx" size="60"></td> <td></td> </tr> <tr> <th>eml</th> <td style="text-align: right">E-mail:</td> <td><input name="param.eml" size="60"></td> <td></td> </tr> <tr> <th>vrkv</th> <th style="text-align: right">Vrsta:</th> <td><input name="param.vrkv" size="60"></td> <td></td> </tr> <tr> <th>lpb</th> <td style="text-align: right">Lokalni pozivni broj:</td> <td><input name="param.lpb" size="60"></td> <td></td> </tr> <tr> <th>idkod</th> <th style="text-align: right">nesto pristupa:</th> <td><input name="param.idkod" size="60"></td> <td></td> </tr> <tr> <th>ugbrz</th> <td style="text-align: right">brzina:</td> <td><input name="param.ugbrz" size="60"></td> <td></td> </tr> <tr> <th>iatk</th> <th style="text-align: right; ">Name:</th> <td><textarea name="param.iatk" cols="40" rows="3"></textarea></td> <td></td> </tr> <tr> <th>dkk</th> <td style="text-align: right">Datum koji odredi krajnji korisnik (ukoliko je to primjenjivo):</td> <td><input name="param.dkk" size="60"></td> <td></td> </tr> <tr> <th>opkv</th> <th style="text-align: right">Opis kvara:</th> <td><textarea name="param.opkv" cols="40"></textarea></td> <td></td> </tr> <tr> <th colspan="2" style="text-align: right">Dokumentacija u TIFF formatu:</th> <td><input type="file" name="attachment"></td> <td></td> </tr> <tr> <td colspan="2"></td> <td colspan="2"> <input type="submit" value="Pozovi"> PHP code: function saljipostom() { $postdata = 'type=SVA&accountCode=101010&param.konos=osoba&param.tel=016000840&param.tfx=&param.eml=&param.vrkv=vrsta&param.lpb=&param.idkod=02637992641&param.ugbrz=&param.iatk=imekorisnika&param.dkk=&param.opkv=opis&attachment=&submit=Pozovi'; $fields = array( 'type'=>'SVA', 'accountCode'=>'101010', 'param.konos'=>'osoba', 'param.tel'=>'016000840', 'param.tfx'=>'', 'param.eml'=>'', 'param.vrkv'=>'vrsta', 'param.lpb'=>'', 'param.idkod'=>'02637992641', 'param.ugbrz'=>'', 'param.iatk'=>'imekorisnika', 'param.dkk'=>'', 'param.opkv'=>'opis', 'attachment'=>'' ); $polje = $fields; foreach ( $fields as $key => $value) { $post_items[] = $key . '=' . urlencode($value); } $post_string = implode ('&', $post_items); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://something.something/ui/ganimed/b2b/newFault?type=SVA"); curl_setopt($ch,CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0"); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, 'curl/cookies.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'curl/cookies.txt'); $result = curl_exec ($ch); curl_close ($ch); unset($ch); $page = str_get_html($result); echo $page; } Response header from curl: HTTP/1.1 200 OK Date: Thu, 24 Jan 2013 08:05:17 GMT Content-Type: text/html;charset=UTF-8 Content-Language: en-US Vary: Accept-Encoding Transfer-Encoding: chunked Firebug says post fields are: typeSVA accountCode param.konos param.tel param.tfx param.eml param.vrkv param.lpb param.idkod param.ugbrz param.iatk param.dkk param.opkv attachment Headers in firebug when form is submitted in browser: Response Headers: Connection Keep-Alive Content-Language en-US Content-Length 0 Content-Type text/plain Date Thu, 24 Jan 2013 12:52:46 GMT Keep-Alive timeout=15, max=100 Location https://something.something/ui/something/b2b/faults?type=SVA&guid=40898022-1b33-42ab-a9f2-696cc5f70950 Request Headers: Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding gzip, deflate Accept-Language en-us,en;q=0.5 Connection keep-alive Cookie JSESSIONID=DD0148C1D1701FA237704C42DE093687.node1 Host something Referer https://something.something/ui/something/something/newFault?type=SVA User-Agent Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0 QUestion: The problem I'm having is occurring on the page with the form, specifically, curl executes and fetches the page, but the post data is not sent, i.e. form is not accepting it(data is sent as array, also tried urlencoded string) ANy ideas? Anything else you need just ask.
  9. Hello Everyone, My first post here, glad to find this community, down to business: What I am trying to do regards the website mochigames.com. Whenever you load up one of their flash games, there is an advertisement that displays as an overlay before it launches. I'd like to be able to screenshot the area of the browser that contains the game (a 640 x 480 div), and then click-through the ad and keep track of the URL(s) until the final advertisement URL is reached. Some ads go straight to the ad page when you click, while others redirect the URL a couple times before arriving at the final destination URL. So basically, I want to supply cURL with the URLs for various games, and get the script to create a respectable screenshot, and record the URL(s) to the destination advertisement. Any ideas? Pretty new to cURL. Thanks for any assistance in advance!
  10. Wondering if anyone can help - I'm not entirely sure I'm getting this right. Actually, I know I'm, because it ain't working! I've retrieved a set of pages using cURL, all working fine, and then using a foreach loop to process each page which will either have one main image, or a main image and thumbnails. I've been scratching my head for many hours trying to figure out the logic to get either the thumbnails (and then I can retrieve the bigger images) or just the one big image. Here's the part of the loop: if($node->nodeName == 'div' && $node->getAttribute('id') == 'bigImageWindow' && $node->getAttribute('class') == 'hasThumbnails') { // We have more than 1 image, so use the thumbs approach //echo "a:<br />"; $setImageSrc = "a"; } elseif($node->nodeName == 'ul' && $node->getattribute('id') == 'thumbPage0') { //echo "b:<br />"; $setImageSrc = "b"; } if($setImageSrc == 'a') { if($node->nodeName == 'img' && $node->getAttribute('id') == 'largeImage') { $instr_images[] = $node->getAttribute('src'); } } else { if($node->nodeName == 'ul' && $node->getAttribute('id') == 'thumbPage0') { $vnodes = $node->childNodes; foreach($vnodes as $vnode) { if($vnode->nodeName == 'li') { $wnodes = $vnode->childNodes; foreach($wnodes as $wnode) { if($wnode->nodeName == 'a'){ $xnodes = $wnode->childNodes; foreach($xnodes as $xnode){ if($xnode->nodeName == 'img'){ $instr_images[] = $xnode->getAttribute('src'); } } } } } } } } I know it's a bit long-winded, but the idea is simple. If the page has thumbnails, use those, else, just grab the main image. As you can see from the latest attempt, I'm trying to set a $setImageSrc to process either option a or option b. At best, I've managed to get all the images, but a duplicated first image - this is due to it reading both the big image AND thumbnails - despite the logic that it should be doing either/or... Any ideas?
  11. Browser result is different than php curl output. How to fix it? http://kat.ph/applications/?rss=1 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://kat.ph/applications/?rss=1"); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/rss+xml; charset=ISO-8859-1", "Content-length: ")); $result = curl_exec($ch); curl_close($ch); echo $result;
  12. i am trying to load the current users images from instagrams api. i got there user id and other things but i cant seem to get the recent media that they posted ... here is the codes im using protected $_endpointUrls = array( 'authorize' => 'https://api.instagram.com/oauth/authorize/?client_id=%s&redirect_uri=%s&response_type=%s', 'access_token' => 'https://api.instagram.com/oauth/access_token', 'user' => 'https://api.instagram.com/v1/users/%d/?access_token=%s', 'user_feed' => 'https://api.instagram.com/v1/users/self/feed?%s', 'user_recent' => 'https://api.instagram.com/v1/users/%s/media/recent/?access_token=%s&max_id=%s&min_id=%s&max_timestamp=%s&min_timestamp=%s',); public function getUserRecent($id, $maxId = '', $minId = '', $maxTimestamp = '', $minTimestamp = '') { $endpointUrl = sprintf($this->_endpointUrls['user_recent'], $id, $this->getAccessToken(), $maxId, $minId, $maxTimestamp, $minTimestamp); $this->_initHttpClient($endpointUrl); return $this->_getHttpClientResponse(); } this is where i call upon those two to get the users photos but it wont display them <? $userphotos = $instagram-> getUserRecent($_SESSION['InstagramAccessToken']); $photos = json_decode($userphotos, true); ?> <?= $photos['data']['user']['user_recent'] ?>
  13. hello guys i have been tryning this code for quite sum time now. it sends sms but i want the server response to display without refreshing the page, i have use cURL extension and cant seem to get it working. the script run smooth but it return the url as the response and it does not execute the url here is the code <?php class send { public $username; public $password; public $destination; public $sender; public $msg; public $type; public $dlr; public $url; function __construct() { } function send_sms(){ $posturl = 'http://121.241.242.114:8080/bulksms/bulksms?'; $number = $this->destination; $number = urlencode($number); $msg = urlencode($this->msg); $type='0'; $dlr='0'; $url=''; $posturl = $posturl."source=".$this->sender."&username=".$this->username."&password=".$this->password."&type=".$type."&dlr=".$dlr."&destination=".$number."&message=".$msg; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $posturl); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); return $posturl; } } ?> i have no idea wat am i doing wrong. the results are getting captured by javasript from the original page but only display the url and does not execute it
  14. hi im working with instagram API and it uses Curl ... i sorta get it but is there a site where i could learn more or anyone here that knows about curl?
  15. Hi guys, I'm having a go at making a curl link that auto logs into another remote site. I managed to get the login part sorted after about a day of searching by using the CURLOPT_FOLLOWLOCATION and CURLOPT_COOKIEJAR settings to handle the session and the redirect after login, but I can't get the remote sites css and jquery paths to resolve as the cURL page keeps trying to use the reffrerential paths to the scripts with my server here, where obviously they don't exist. I have tried setting the CURLOPT_REFERER and CURLOPT_AUTOREFERER values but it's not made any difference, and from what I can read they arn't anything to do with my problem. I havn't used cURL for anything productive before so I'm not really femiliar with it. What am I missing that will let me tell the page to load the css and jquery using the remote server domain rather than my local one?
  16. I would like to develop a system that makes remote reading of the result of some search sites. These results are paginated and many sites use ajax to load pages. How can I accomplish this system with php? example of a site search page result: http://busca.submarino.com.br/busca.php?q=celular&sessao=4b712361eee996720660b5d6bde5dfc1f22066c9&idbusca=c9aeb969a4e7fb45bbbf152c85f1234cd768f5e7 As you can see at the bottom of the page, there is some javascript attached to the pagination link. Can anyone help with some idea? Thanks
  17. How can i save ringtone from url http://m.zedge.net/?p=ringtone-1254608&b=&m=0&browse-history-clean=1&s_p=5937 using curl in PHP. Anybody can help me to do this. Thank you so much!
  18. Is it possible for a site to block cURL? Here's my code that was working about a month ago: <?php $tumblr_email = 'user@user.com'; $tumblr_password = 'pass'; $request_data = http_build_query( array( 'email' => $tumblr_email, 'password' => $tumblr_password ) ); $c1 = curl_init('http://www.tumblr.com/login'); curl_setopt($c1, CURLOPT_POST, true); curl_setopt($c1, CURLOPT_POSTFIELDS, $request_data); curl_setopt($c1, CURLOPT_RETURNTRANSFER, true); curl_setopt($c1, CURL_COOKIEFILE, 'cookie.txt'); curl_setopt($c1, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($c1, CURLOPT_FOLLOWLOCATION,true); $result1 = curl_exec($c1); echo $result1; curl_close($c1); ?>
  19. I need to write a curl functionality, where the datas are stored in the table format. I need to write a function to read all the <tr> and its <td> <td> contains text and link like the below. could anyone help me how to read a text along with the link. for example: <table> <tr> <td> <div> <a href="link.html">td data </a><div></</td> <td> <div> <a href="link.html">td data </a><div></</td> </tr> <tr> <td> <div> <a href="link.html">td data </a><div></</td> <td> <div> <a href="link.html">td data </a><div></</td> </tr> </table>
  20. Hello guys, it's my first post here.... Here is the code I got for now(changed the domain and subdomain names): <?php $agent = "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16"; $headers = "Expect:"; $postdata = "username=test&password=test&ref=".base64_encode(md5(time().".com"))."&session=s".md5(time()); $login="http://subdomain.mydomain.com/login.php"; $grab="http://subdomain.mydomain.com/index.php"; function login($url,$data){ $fp = fopen("cookie.txt", "w"); fclose($fp); $login = curl_init(); curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($login, CURLOPT_TIMEOUT, 40000); curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($login, CURLOPT_URL, $url); curl_setopt($login, CURLOPT_USERAGENT, $agent); curl_setopt($login, CURLOPT_COOKIESESSION, true); curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($login, CURLOPT_POST, TRUE); curl_setopt($login, CURLOPT_POSTFIELDS, $data); ob_start(); return curl_exec ($login); ob_end_clean(); curl_close ($login); unset($login); } function grab_page($site){ $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_TIMEOUT, 40000); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($login, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_URL, $site); ob_start(); return curl_exec ($ch); ob_end_clean(); curl_close ($ch); } function grab_subpage($site){ $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_TIMEOUT, 40000); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($login, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_URL, $site); ob_start(); return curl_exec ($ch); ob_end_clean(); curl_close ($ch); } function post_data($site,$data){ $datapost = curl_init(); curl_setopt($datapost, CURLOPT_URL, $site); curl_setopt($datapost, CURLOPT_TIMEOUT, 40000); curl_setopt($datapost, CURLOPT_HEADER, TRUE); curl_setopt($datapost, CURLOPT_HTTPHEADER, $headers); curl_setopt($datapost, CURLOPT_USERAGENT, $agent); curl_setopt($datapost, CURLOPT_POST, TRUE); curl_setopt($datapost, CURLOPT_POSTFIELDS, $data); curl_setopt($datapost, CURLOPT_COOKIEFILE, "cookie.txt"); ob_start(); return curl_exec ($datapost); ob_end_clean(); curl_close ($datapost); unset($datapost); } login($login, $postdata); echo grab_page($grab); ?> OK , so ... this code works fine if i navigate any page from http://subdomain.mydomain.com/ but if i try to grab a page from http://anothersubdomain.mydomain.com/ it drops and shows me a white page. var_dump(grab_page($grab)); echoes me string(0) "" . I can't figure out what is the problem and why I can't access that page. I'm googling for a week now and tryied tons of metods and nothing worked, maybe you guys can help me... Thanks in advance.
  21. Hello, I can't use CURL, $ch = curl_init(); I get the error I've used phpinfo() and found the php.ini directory, Loaded Configuration File D:\wamp\bin\apache\apache2.2.22\bin\php.ini I've then edited the php.ini file from that directory and removed the semi-colon in-front of extension=php_curl.dll Restarted Apache but am still receiving the error. I'm using Wamp and I know there's another php.ini file in the D:\wamp\bin\php directory, so I've uncommented that line from that file too, restarted Apache and still receive the error. I don't know where to go from here, can anyone advise me please?
  22. I need to ask my host to open a port for outbound connections via cURL. THey are telling me that they cannot open inbound ports for my hosting package type. I have been told that curl or file_get_contents makes an outbound connection. I can't seem to verify this through the docs unless I am missing something. Can anyone verify before I go back to my host and make a fool of myself?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.