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

Found 2 results

  1. Good morning guys. I am pulling data from vehicle tracking site via soap curl. but the data format that I am getting it in is unusable, maybee i am doing something wrong. please have a look. here is the code. <?php //Data, connection, auth $dataFromTheForm = $_POST['fieldName']; // request data from the form $soapUrl = "https://fleet11.******.co.za/api/"; // asmx URL of WSDL $soapUser = "********"; // username $soapPassword = "********"; // password // xml post structure $xml_post_string = '<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="fleet11.cartrack.co.za/api/"> <soapenv:Header/> <soapenv:Body> <api:endpoint.get_vehicle_last_positions soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <username xsi:type="xsd:string">?</username> </api:endpoint.get_vehicle_last_positions> </soapenv:Body> </soapenv:Envelope>'; $headers = array( "Content-type: application/x-www-form-urlencoded", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: fleet11.******.co.za/api/#get_vehicle_last_positions", "Content-length: ".strlen($xml_post_string), ); $url = $soapUrl; // var_dump($url); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); `curl_setopt($ch, CURLOPT_HEADER, true);` // converting $response = curl_exec($ch); curl_close($ch); //paul add //echo "<pre>"; print_r($response); What is returning is single line entries How di i get this into a format to import into mysql
  2. Dannyeo

    Curl

    Hi there I am trying to redirect mobile users automatically from the desktop to the moble version of a website. I have been provided with the following Curl code which I have placed in the Header.php file of my Wordpress site. I have confirmed with my Hosting provider who have said they do support Curl statements. Unfortunately I am getting a parse error in line 8: Parse error: syntax error, unexpected ';', expecting ')' <?php $domain_www = 'http://mydomain.co.uk'; $domain_mobi = 'http://m.mydomain.co.uk'; // Manually specify page by page redirects $mobile_urls = array($domain_www.'/' => $domain_mobi.'/', // Homepage $domain_www.'/page.php' => $domain_mobi.'/page.php', // Leave the code below unchanged to execute the mobile redirect $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.someotherdomainsomwhere.com/detect-mobile.php"); // returns if mobile $fields_string = 'usr='.urlencode($_SERVER['HTTP_USER_AGENT']).''; curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); $response = htmlentities($output); if(trim($response) == '1') { foreach ($mobile_urls as $i => $value) { if(strtolower('http://'.$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"])==strtolower($i)) { Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: ".strtolower($value) ); exit(); } } } ?> Any help would be much appreciated. Even if I remove the ; from line 8 I then get an error on line stating Parse error: syntax error, unexpected T_STRING, expecting ')' Also, where would you recommend storing this code on a Wordpress installation? Thanks DY
×
×
  • 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.